1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s |
2 | |
3 | struct __objcFastEnumerationState; |
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; |
28 | for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \ |
29 | expected-error {{the type 'int *' is not a pointer to a fast-enumerable object}} |
30 | ++i; |
31 | for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \ |
32 | expected-error {{selector element type 'int' is not a valid object}} |
33 | ++i; |
34 | for (id se in i) // expected-error {{the type 'int' is not a pointer to a fast-enumerable object}} |
35 | ++i; |
36 | } |
37 | @end |
38 | |
39 | |