]> git.proxmox.com Git - rustc.git/blame - src/llvm/tools/clang/test/SemaObjC/protocol-archane.m
Imported Upstream version 0.6
[rustc.git] / src / llvm / tools / clang / test / SemaObjC / protocol-archane.m
CommitLineData
223e47cc
LB
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2// rdar://5986251
3
4@protocol SomeProtocol
5- (void) bar;
6@end
7
8void bar();
9void 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
27typedef int NotAnObjCObjectType;
28
29// GCC doesn't diagnose this.
30NotAnObjCObjectType <SomeProtocol> *obj; // expected-error {{invalid protocol qualifiers on non-ObjC type}}
31
32typedef struct objc_class *Class;
33
34Class <SomeProtocol> UnfortunateGCCExtension;
35
36// rdar://10238337
37@protocol Broken @end
38@interface Crash @end
39@implementation Crash
40- (void)crashWith:(<Broken>)a { // expected-warning {{protocol qualifiers without 'id' is archaic}}
41}
42@end