1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-pointer-to-int-cast -Wno-objc-root-class -Wno-strict-prototypes %s 2 3@protocol SomeProtocol 4- (void) bar; 5@end 6 7void bar(); 8void foo(id x) { 9 bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}} 10 bar((<SomeProtocol>)x); // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}} 11 12 [(<SomeProtocol>)x bar]; // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}} 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 26typedef int NotAnObjCObjectType; 27 28// GCC doesn't diagnose this. 29NotAnObjCObjectType <SomeProtocol> *obj; // expected-error {{invalid protocol qualifiers on non-ObjC type}} 30 31typedef struct objc_class *Class; 32 33Class <SomeProtocol> UnfortunateGCCExtension; 34 35@protocol Broken @end 36@interface Crash @end 37@implementation Crash 38- (void)crashWith:(<Broken>)a { // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}} 39} 40@end 41 42typedef <SomeProtocol> id TwoTypeSpecs; // expected-warning{{no object type specified}} 43// expected-error@-1{{typedef redefinition with different types ('id<SomeProtocol>' vs 'id')}} 44// expected-error@-2{{expected ';' after top level declarator}} 45