1 /* RUN: %clang_cc1 -Wall -Wno-unused-but-set-variable -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.
15 for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
16 for (id thisKey in keys); /* expected-warning {{unused variable 'thisKey'}} */
19 @protocol NSObject @end
21 @interface NSObject <NSObject> {
29 unsigned long *mutationsPtr;
30 unsigned long extra[5];
31 } NSFastEnumerationState;
33 @protocol NSFastEnumeration
35 - (unsigned long)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(unsigned long)len;
41 NSObject<NSFastEnumeration>* collection = ((void*)0);
42 for (id thing in collection) { } /* expected-warning {{unused variable 'thing'}} */
48 @property (assign) id prop;
50 void test2(NSObject<NSFastEnumeration> *collection) {
52 for (obj.prop in collection) { /* expected-error {{selector element is not a valid lvalue}} */
58 void test3(NSObject<NSFastEnumeration> *a0, NSObject<NSFastEnumeration> *a1) {
59 for (id i in a0) { /* expected-note 2 {{jump enters Objective-C fast enumeration loop}} */
60 for (id j in a1) { /* expected-note 2 {{jump enters Objective-C fast enumeration loop}} */
68 goto label0; /* expected-error {{cannot jump from this goto statement to its label}} */
75 goto label0; /* expected-error {{cannot jump from this goto statement to its label}} */
77 goto label1; /* expected-error{{cannot jump from this goto statement to its label}} */