Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 1f990d6 | 2008-01-04 00:27:46 +0000 | [diff] [blame] | 2 | |
Fariborz Jahanian | 7f53253 | 2011-02-09 22:20:01 +0000 | [diff] [blame] | 3 | struct __objcFastEnumerationState; |
Fariborz Jahanian | 1f990d6 | 2008-01-04 00:27:46 +0000 | [diff] [blame] | 4 | typedef struct objc_class *Class; |
| 5 | typedef struct objc_object { |
| 6 | Class isa; |
| 7 | } *id; |
| 8 | |
| 9 | |
| 10 | @interface MyList |
| 11 | @end |
| 12 | |
| 13 | @implementation MyList |
| 14 | - (unsigned int)countByEnumeratingWithState: (struct __objcFastEnumerationState *)state objects: (id *)items count:(unsigned int)stackcount |
| 15 | { |
| 16 | return 0; |
| 17 | } |
| 18 | @end |
| 19 | |
| 20 | @interface MyList (BasicTest) |
| 21 | - (void)compilerTestAgainst; |
| 22 | @end |
| 23 | |
| 24 | @implementation MyList (BasicTest) |
| 25 | - (void)compilerTestAgainst { |
| 26 | |
| 27 | int i=0; |
Chris Lattner | d162584 | 2008-11-24 06:25:27 +0000 | [diff] [blame] | 28 | for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \ |
| 29 | expected-error {{collection expression type 'int *' is not a valid object}} |
Fariborz Jahanian | 1f990d6 | 2008-01-04 00:27:46 +0000 | [diff] [blame] | 30 | ++i; |
| 31 | for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \ |
Chris Lattner | d162584 | 2008-11-24 06:25:27 +0000 | [diff] [blame] | 32 | expected-error {{selector element type 'int' is not a valid object}} |
Fariborz Jahanian | 1f990d6 | 2008-01-04 00:27:46 +0000 | [diff] [blame] | 33 | ++i; |
Chris Lattner | d162584 | 2008-11-24 06:25:27 +0000 | [diff] [blame] | 34 | for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}} |
Fariborz Jahanian | 1f990d6 | 2008-01-04 00:27:46 +0000 | [diff] [blame] | 35 | ++i; |
| 36 | } |
| 37 | @end |
| 38 | |