]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaObjC/protocol-archane.m
Update clang to r89205.
[FreeBSD/FreeBSD.git] / test / SemaObjC / protocol-archane.m
1 // RUN: clang-cc -fsyntax-only -verify %s
2 // rdar://5986251
3
4 @protocol SomeProtocol
5 - (void) bar;
6 @end
7
8 void foo(id x) {
9   bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}}
10   bar((<SomeProtocol>)x);      // expected-warning {{protocol qualifiers without 'id' is archaic}}
11
12   [(<SomeProtocol>)x bar];      // expected-warning {{protocol qualifiers without 'id' is archaic}}
13 }
14
15 @protocol MyProtocol
16 - (void)doSomething;
17 @end
18
19 @interface MyClass
20 - (void)m1:(id <MyProtocol> const)arg1;
21
22 // FIXME: provide a better diagnostic (no typedef).
23 - (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short type-name' is invalid}}
24 @end
25
26 typedef int NotAnObjCObjectType;
27
28 // GCC doesn't diagnose this.
29 NotAnObjCObjectType <SomeProtocol> *obj; // expected-error {{invalid protocol qualifiers on non-ObjC type}}
30
31 typedef struct objc_class *Class;
32
33 Class <SomeProtocol> UnfortunateGCCExtension;
34