2012-04-07 02:12:22 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
2008-07-26 08:46:50 +08:00
|
|
|
// rdar://5986251
|
2008-07-26 08:20:22 +08:00
|
|
|
|
|
|
|
@protocol SomeProtocol
|
2008-07-26 08:46:50 +08:00
|
|
|
- (void) bar;
|
2008-07-26 08:20:22 +08:00
|
|
|
@end
|
|
|
|
|
2010-01-10 04:43:19 +08:00
|
|
|
void bar();
|
2008-07-26 08:20:22 +08:00
|
|
|
void foo(id x) {
|
2008-11-24 07:17:07 +08:00
|
|
|
bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
2008-07-26 08:20:22 +08:00
|
|
|
bar((<SomeProtocol>)x); // expected-warning {{protocol qualifiers without 'id' is archaic}}
|
2008-07-26 08:46:50 +08:00
|
|
|
|
|
|
|
[(<SomeProtocol>)x bar]; // expected-warning {{protocol qualifiers without 'id' is archaic}}
|
2008-07-26 08:20:22 +08:00
|
|
|
}
|
|
|
|
|
2008-09-22 18:28:57 +08:00
|
|
|
@protocol MyProtocol
|
|
|
|
- (void)doSomething;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface MyClass
|
|
|
|
- (void)m1:(id <MyProtocol> const)arg1;
|
|
|
|
|
|
|
|
// FIXME: provide a better diagnostic (no typedef).
|
2009-02-09 23:09:02 +08:00
|
|
|
- (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short type-name' is invalid}}
|
2009-02-22 03:50:43 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
typedef int NotAnObjCObjectType;
|
|
|
|
|
|
|
|
// GCC doesn't diagnose this.
|
2009-02-24 02:53:24 +08:00
|
|
|
NotAnObjCObjectType <SomeProtocol> *obj; // expected-error {{invalid protocol qualifiers on non-ObjC type}}
|
|
|
|
|
|
|
|
typedef struct objc_class *Class;
|
|
|
|
|
2009-07-23 00:07:01 +08:00
|
|
|
Class <SomeProtocol> UnfortunateGCCExtension;
|
2009-02-24 02:53:24 +08:00
|
|
|
|
2011-10-06 05:28:06 +08:00
|
|
|
// rdar://10238337
|
|
|
|
@protocol Broken @end
|
|
|
|
@interface Crash @end
|
|
|
|
@implementation Crash
|
|
|
|
- (void)crashWith:(<Broken>)a { // expected-warning {{protocol qualifiers without 'id' is archaic}}
|
|
|
|
}
|
|
|
|
@end
|