diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-18 00:52:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-18 00:52:05 +0000 |
commit | 0875c53239dde03319099d8ae4ac12a4025709e8 (patch) | |
tree | 7649b32a1e208b22e0d951a72764cb8ba0697347 /clang/test/Parser/cxx-stmt.cpp | |
parent | 5657555357af46e44a1970f7a7aa8f5ced35aa79 (diff) | |
download | bcm5719-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/cxx-stmt.cpp')
-rw-r--r-- | clang/test/Parser/cxx-stmt.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-stmt.cpp b/clang/test/Parser/cxx-stmt.cpp index 7677ca88012..c2fa0a4df0d 100644 --- a/clang/test/Parser/cxx-stmt.cpp +++ b/clang/test/Parser/cxx-stmt.cpp @@ -58,3 +58,11 @@ void f5() { asm volatile ("":: :"memory"); asm volatile ("": ::"memory"); } + +int f6() { + int k, // expected-note {{change this ',' to a ';' to call 'f6'}} + f6(), // expected-error {{expected ';'}} expected-warning {{interpreted as a function declaration}} expected-note {{replace paren}} + int n = 0, // expected-error {{expected ';'}} + return f5(), // ok + int(n); +} |