Chris Lattner | bce6135 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Chris Lattner | 62f5f7f | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 2 | // rdar://5986251 |
Chris Lattner | bce6135 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 3 | |
| 4 | @protocol SomeProtocol |
Chris Lattner | 62f5f7f | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 5 | - (void) bar; |
Chris Lattner | bce6135 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | void foo(id x) { |
Chris Lattner | 28eb7e9 | 2008-11-23 23:17:07 +0000 | [diff] [blame] | 9 | bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}} |
Chris Lattner | bce6135 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 10 | bar((<SomeProtocol>)x); // expected-warning {{protocol qualifiers without 'id' is archaic}} |
Chris Lattner | 62f5f7f | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 11 | |
| 12 | [(<SomeProtocol>)x bar]; // expected-warning {{protocol qualifiers without 'id' is archaic}} |
Chris Lattner | bce6135 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 13 | } |
| 14 | |
Steve Naroff | 4f9b9f1 | 2008-09-22 10:28:57 +0000 | [diff] [blame] | 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). |
Douglas Gregor | 1a51b4a | 2009-02-09 15:09:02 +0000 | [diff] [blame] | 23 | - (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short type-name' is invalid}} |
Steve Naroff | 8dfb0c5 | 2009-02-21 19:50:43 +0000 | [diff] [blame^] | 24 | @end |
| 25 | |
| 26 | typedef int NotAnObjCObjectType; |
| 27 | |
| 28 | // GCC doesn't diagnose this. |
| 29 | NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning {{ignoring protocol qualifiers on non-ObjC type}} |