aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-condition.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-09-09 20:38:47 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-09-09 20:38:47 +0000
commit71b914b999d9c4b6df11068fc5a3291ac4770492 (patch)
tree0466eb3657ad0a3045834832e0ce684fb2c97256 /test/Parser/cxx-condition.cpp
parent8bd3dc64d28bdb3b263838a12aca25587bce661b (diff)
Implement parser support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-condition.cpp')
-rw-r--r--test/Parser/cxx-condition.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Parser/cxx-condition.cpp b/test/Parser/cxx-condition.cpp
new file mode 100644
index 0000000000..ccb7767173
--- /dev/null
+++ b/test/Parser/cxx-condition.cpp
@@ -0,0 +1,11 @@
+// RUN: clang -parse-noop %s -verify
+
+void f() {
+ int a;
+ while (a) ;
+ while (int x) ; // expected-error {{expected '=' after declarator}}
+ while (float x = 0) ;
+ if (const int x = a) ;
+ switch (int x = a+10) {}
+ for (; int x = ++a; ) ;
+}