1 /* RUN: %clang_cc1 -Wall -fsyntax-only -verify -std=c89 -pedantic %s
8 for (int i in a); /* expected-error{{selector element type 'int' is not a valid object}} */
9 for ((id)2 in a); /* expected-error{{selector element is not a valid lvalue}} */
10 for (2 in a); /* expected-error{{selector element is not a valid lvalue}} */
12 /* This should be ok, 'thisKey' should be scoped to the loop in question,
13 * and no diagnostics even in pedantic mode should happen.
16 for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
17 for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
20 /* // rdar://9072298 */
21 @protocol NSObject @end
23 @interface NSObject <NSObject> {
31 unsigned long *mutationsPtr;
32 unsigned long extra[5];
33 } NSFastEnumerationState;
35 @protocol NSFastEnumeration
37 - (unsigned long)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(unsigned long)len;
43 NSObject<NSFastEnumeration>* collection = ((void*)0);
44 for (id thing in collection) { } /* expected-warning {{unused variable 'thing'}} */
49 /* rdar://problem/11068137 */
51 @property (assign) id prop;
53 void test2(NSObject<NSFastEnumeration> *collection) {
55 for (obj.prop in collection) { /* expected-error {{selector element is not a valid lvalue}} */