blob: 2b62b1744ce276f4f28e9ddd0a94914147db6edb [file] [log] [blame]
Fariborz Jahaniana7cf23a2009-11-19 22:12:37 +00001/* RUN: clang-cc -Wall -fsyntax-only -verify -std=c89 -pedantic %s
Chris Lattner4d00f2a2009-04-22 00:54:41 +00002 */
Anders Carlsson1fe379f2008-08-25 18:16:36 +00003
4@class NSArray;
5
Chris Lattner4d00f2a2009-04-22 00:54:41 +00006void f(NSArray *a) {
7 id keys;
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}} */
11
12 /* This should be ok, 'thisKey' should be scoped to the loop in question,
13 * and no diagnostics even in pedantic mode should happen.
14 * rdar://6814674
15 */
16 for (id thisKey in keys);
17 for (id thisKey in keys);
Chris Lattnerd1625842008-11-24 06:25:27 +000018}