aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjC/foreach.m
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-22 00:59:27 +0000
committerChris Lattner <sabre@nondot.org>2009-04-22 00:59:27 +0000
commitf09f03cd1f712371c26014ffc59585ead2f28515 (patch)
tree76af770ed678ce48e69d92e8636d1246b73477f8 /test/SemaObjC/foreach.m
parent4d00f2a5a9b670cd0d67d640a42dbf7b9f342c59 (diff)
rename test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC/foreach.m')
-rw-r--r--test/SemaObjC/foreach.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaObjC/foreach.m b/test/SemaObjC/foreach.m
new file mode 100644
index 0000000000..f136adfa36
--- /dev/null
+++ b/test/SemaObjC/foreach.m
@@ -0,0 +1,18 @@
+/* RUN: clang-cc -fsyntax-only -verify -std=c89 -pedantic %s
+ */
+
+@class NSArray;
+
+void f(NSArray *a) {
+ id keys;
+ for (int i in a); /* expected-error{{selector element type 'int' is not a valid object}} */
+ for ((id)2 in a); /* expected-error{{selector element is not a valid lvalue}} */
+ for (2 in a); /* expected-error{{selector element is not a valid lvalue}} */
+
+ /* This should be ok, 'thisKey' should be scoped to the loop in question,
+ * and no diagnostics even in pedantic mode should happen.
+ * rdar://6814674
+ */
+ for (id thisKey in keys);
+ for (id thisKey in keys);
+}