Debian Codegraph @

clang/test/SemaObjC/property-ambiguous-synthesis.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3 @protocol FooAsID
4 @property (assign) id foo; // expected-note 2 {{it could also be property of type 'id' declared here}} \\
5 // expected-warning {{property of type 'id' was selected for synthesis}}
6 @end
7
8 @protocol FooAsDouble
9 @property double foo; // expected-warning 2 {{property of type 'double' was selected for synthesis}} \
10 // expected-note {{it could also be property of type 'double' declared here}}
11 @end
12
13 @protocol FooAsShort
14 @property short foo; // expected-note {{it could also be property of type 'short' declared here}}
15 @end
16
17 @interface NSObject @end
18
19 @interface AnObject : NSObject<FooAsDouble,FooAsID>
20 @end
21
22 @interface Sub : AnObject
23 @end
24
25 @implementation Sub
26 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
27 @end
28
29
30 @interface AnotherObject : NSObject<FooAsDouble, FooAsID,FooAsDouble, FooAsID, FooAsDouble,FooAsID>
31 @end
32
33 @implementation AnotherObject
34 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
35 @end
36
37
38 @interface YetAnotherObject : NSObject<FooAsID,FooAsShort, FooAsDouble,FooAsID, FooAsShort>
39 @end
40
41 @implementation YetAnotherObject
42 @synthesize foo=_MyFooIvar; // expected-note {{property synthesized here}}
43 @end
44
45 double func(YetAnotherObject *object) {
46 return [object foo]; // expected-error {{returning 'id' from a function with incompatible result type 'double'}}
47 }