Keep the source location of the selector in ObjCMessageExpr.
[clang.git] / test / SemaObjC / foreach.m
blob0f7fd9eea9922c4e94adebbb27f389a1f5df7eb7
1 /* RUN: %clang_cc1 -Wall -fsyntax-only -verify -std=c89 -pedantic %s
2  */
4 @class NSArray;
6 void 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);