Chris Lattner | b99d749 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Chris Lattner | 4a68fe0 | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 2 | // rdar://5986251 |
Chris Lattner | b99d749 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 3 | |
| 4 | @protocol SomeProtocol |
Chris Lattner | 4a68fe0 | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 5 | - (void) bar; |
Chris Lattner | b99d749 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | void foo(id x) { |
Chris Lattner | 921342c | 2008-11-23 23:17:07 +0000 | [diff] [blame] | 9 | bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}} |
Chris Lattner | b99d749 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 10 | bar((<SomeProtocol>)x); // expected-warning {{protocol qualifiers without 'id' is archaic}} |
Chris Lattner | 4a68fe0 | 2008-07-26 00:46:50 +0000 | [diff] [blame] | 11 | |
| 12 | [(<SomeProtocol>)x bar]; // expected-warning {{protocol qualifiers without 'id' is archaic}} |
Chris Lattner | b99d749 | 2008-07-26 00:20:22 +0000 | [diff] [blame] | 13 | } |
| 14 | |
Steve Naroff | f768330 | 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 | a60c62e | 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 | c84582b | 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}} |