view gcc/testsuite/objc.dg/proto-init-mimatch-1.m @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* Test to warn on protocol mismatch in a variety of initializations. */

/* { dg-do compile } */

typedef struct objc_class *Class;

typedef struct objc_object {
        Class isa;
} *id;

@protocol NSObject
@end

@interface NSObject <NSObject> 
@end

@protocol NSCopying
- (void)copyWithZone;
@end

@interface Foo:NSObject <NSCopying> 
@end


extern id <NSObject> NSCopyObject();

@implementation Foo
- (void)copyWithZone {
    Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */

    Foo<NSObject,NSCopying> *g = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */

    id<NSObject,NSCopying> h = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */
}
@end