| 1 |
/* Test to warn on protocol mismatch in a variety of initializations. */ |
| 2 |
|
| 3 |
/* { dg-do compile } */ |
| 4 |
|
| 5 |
typedef struct objc_class *Class; |
| 6 |
|
| 7 |
typedef struct objc_object { |
| 8 |
Class isa; |
| 9 |
} *id; |
| 10 |
|
| 11 |
@protocol NSObject |
| 12 |
@end |
| 13 |
|
| 14 |
@interface NSObject <NSObject> |
| 15 |
@end |
| 16 |
|
| 17 |
@protocol NSCopying |
| 18 |
- (void)copyWithZone; |
| 19 |
@end |
| 20 |
|
| 21 |
@interface Foo:NSObject <NSCopying> |
| 22 |
@end |
| 23 |
|
| 24 |
|
| 25 |
extern id <NSObject> NSCopyObject(); |
| 26 |
|
| 27 |
@implementation Foo |
| 28 |
- (void)copyWithZone { |
| 29 |
Foo *copy = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */ |
| 30 |
|
| 31 |
Foo<NSObject,NSCopying> *g = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */ |
| 32 |
|
| 33 |
id<NSObject,NSCopying> h = NSCopyObject(); /* { dg-warning "type \\'id <NSObject>\\' does not conform to the \\'NSCopying\\' protocol" } */ |
| 34 |
} |
| 35 |
@end |