summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/statements.c
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-09-18 00:52:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-09-18 00:52:05 +0000
commit0875c53239dde03319099d8ae4ac12a4025709e8 (patch)
tree7649b32a1e208b22e0d951a72764cb8ba0697347 /clang/test/Parser/statements.c
parent5657555357af46e44a1970f7a7aa8f5ced35aa79 (diff)
downloadbcm5719-llvm-0875c53239dde03319099d8ae4ac12a4025709e8.tar.gz
bcm5719-llvm-0875c53239dde03319099d8ae4ac12a4025709e8.zip
If a comma operator is followed by a token which unambiguously indicates the
start of a statement or the end of a compound-statement, diagnose the comma as a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and minor refactoring by me. llvm-svn: 164085
Diffstat (limited to 'clang/test/Parser/statements.c')
-rw-r--r--clang/test/Parser/statements.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Parser/statements.c b/clang/test/Parser/statements.c
index 3a123d6001b..8215f4c92a6 100644
--- a/clang/test/Parser/statements.c
+++ b/clang/test/Parser/statements.c
@@ -62,3 +62,18 @@ void test8() {
// Should not skip '}' and produce a "expected '}'" error.
undecl // expected-error {{use of undeclared identifier 'undecl'}}
}
+
+int test9() {
+ int T[] = {1, 2, };
+
+ int X;
+ X = 0, // expected-error {{expected ';' after expression}}
+ {
+ }
+
+ X = 0, // expected-error {{expected ';' after expression}}
+ if (0)
+ ;
+
+ return 4, // expected-error {{expected ';' after return statement}}
+}
OpenPOWER on IntegriCloud