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