]> granicus.if.org Git - clang/blob - test/Parser/objc-forcollection-neg.m
make some diagnostics more terse, update testcases.
[clang] / test / Parser / objc-forcollection-neg.m
1 // RUN: clang -fsyntax-only -verify %s
2
3 typedef struct objc_class *Class;
4 typedef struct objc_object {
5  Class isa;
6 } *id;
7     
8             
9 @interface MyList
10 @end
11     
12 @implementation MyList
13 - (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
14 {
15         return 0;
16 }
17 @end
18
19 @interface MyList (BasicTest)
20 - (void)compilerTestAgainst;
21 @end
22
23 @implementation MyList (BasicTest)
24 - (void)compilerTestAgainst {
25
26         int i=0;
27         for (int * elem in elem) // expected-error {{selector element type ('int *') is not a valid object}} \
28                                     expected-error {{collection expression type ('int *') is not a valid object}}
29            ++i;
30         for (i in elem)  // expected-error {{use of undeclared identifier 'elem'}} \
31                             expected-error {{selector element type ('int') is not a valid object}}
32            ++i;
33         for (id se in i) // expected-error {{collection expression type ('int') is not a valid object}} 
34            ++i;
35 }
36 @end
37