Patrick Beard | b2f6820 | 2012-04-06 18:12:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
Fariborz Jahanian | 8ce5da3 | 2008-01-07 17:52:35 +0000 | [diff] [blame] | 2 | |
| 3 | typedef struct objc_class *Class; |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 4 | struct __objcFastEnumerationState; |
Fariborz Jahanian | 8ce5da3 | 2008-01-07 17:52:35 +0000 | [diff] [blame] | 5 | typedef struct objc_object { |
| 6 | Class isa; |
| 7 | } *id; |
| 8 | |
Fariborz Jahanian | 8ce5da3 | 2008-01-07 17:52:35 +0000 | [diff] [blame] | 9 | @protocol P @end |
| 10 | |
| 11 | @interface MyList |
| 12 | @end |
| 13 | |
| 14 | @implementation MyList |
| 15 | - (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount |
| 16 | { |
| 17 | return 0; |
| 18 | } |
| 19 | @end |
| 20 | |
| 21 | @interface MyList (BasicTest) |
| 22 | - (void)compilerTestAgainst; |
| 23 | @end |
| 24 | |
| 25 | @implementation MyList (BasicTest) |
| 26 | - (void)compilerTestAgainst { |
Chris Lattner | 35d276f | 2009-02-27 18:53:28 +0000 | [diff] [blame] | 27 | static i;// expected-warning {{type specifier missing, defaults to 'int'}} |
Douglas Gregor | c1ced28 | 2009-02-13 18:20:19 +0000 | [diff] [blame] | 28 | for (id el, elem in self) // expected-error {{only one element declaration is allowed}} |
Fariborz Jahanian | 8ce5da3 | 2008-01-07 17:52:35 +0000 | [diff] [blame] | 29 | ++i; |
| 30 | for (id el in self) |
| 31 | ++i; |
| 32 | MyList<P> ***p; |
Richard Trieu | 2fe9b7f | 2011-12-15 00:38:15 +0000 | [diff] [blame] | 33 | for (p in self) // expected-error {{selector element type 'MyList<P> ***' is not a valid object}} |
Fariborz Jahanian | 8ce5da3 | 2008-01-07 17:52:35 +0000 | [diff] [blame] | 34 | ++i; |
| 35 | |
| 36 | } |
| 37 | @end |
| 38 | |