summaryrefslogtreecommitdiff
path: root/clang/test/Parser/for.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Parser/for.cpp')
-rw-r--r--clang/test/Parser/for.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Parser/for.cpp b/clang/test/Parser/for.cpp
new file mode 100644
index 0000000..e413839
--- /dev/null
+++ b/clang/test/Parser/for.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1() {
+ int n;
+
+ for (n = 0; n < 10; n++);
+
+ for (n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (int n = 0 n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (int n = 0; n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 bool b = n < 10; n++); // expected-error {{expected ';' in 'for'}}
+ for (n = 0; bool b = n < 10 n++); // expected-error {{expected ';' in 'for'}}
+
+ for (n = 0 n < 10 n++); // expected-error 2{{expected ';' in 'for'}}
+
+ for (;); // expected-error {{expected ';' in 'for'}}
+}