summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/proto-init-mimatch-1.mm
blob: 64e52e8126267d76c47df580d0832df71afc6fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* 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