diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-19 21:33:05 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-19 21:33:05 +0000 |
| commit | 09f76ee63c5179dddcd3eb608f392e33d5374f17 (patch) | |
| tree | 6cc32f920e014b19d7fb198dcbd69bea0a7e6692 /clang/test/Parser | |
| parent | d72b178a453ca8cac5d1fb00c38499a1c5c09df8 (diff) | |
| download | bcm5719-llvm-09f76ee63c5179dddcd3eb608f392e33d5374f17.tar.gz bcm5719-llvm-09f76ee63c5179dddcd3eb608f392e33d5374f17.zip | |
Improve the diagnostic when a comma ends up at the end of a declarator group
instead of a semicolon (as sometimes happens during refactorings). When such a
comma is seen at the end of a line, and is followed by something which can't
possibly be a declarator (or even something which might be a plausible typo for
a declarator), suggest that a semicolon was intended.
llvm-svn: 142544
Diffstat (limited to 'clang/test/Parser')
| -rw-r--r-- | clang/test/Parser/cxx-decl.cpp | 32 | ||||
| -rw-r--r-- | clang/test/Parser/cxx0x-decl.cpp | 8 |
2 files changed, 39 insertions, 1 deletions
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp index 70eff973e0e..57f33d826ff 100644 --- a/clang/test/Parser/cxx-decl.cpp +++ b/clang/test/Parser/cxx-decl.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify -fsyntax-only %s +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux %s int x(*g); // expected-error {{use of undeclared identifier 'g'}} @@ -66,6 +66,36 @@ struct test4 { int z // expected-error {{expected ';' at end of declaration list}} }; +// Make sure we know these are legitimate commas and not typos for ';'. +namespace Commas { + struct S { + static int a; + int c, + operator()(); + }; + + int global1, + __attribute__(()) global2, + (global5), + *global6, + &global7 = global1, + &&global8 = static_cast<int&&>(global1), // expected-warning 2{{rvalue reference}} + S::a, + global9, + global10 = 0, + global11 == 0, // expected-error {{did you mean '='}} + global12 __attribute__(()), + global13(0), + global14[2], + global15; + + void g() { + static int a, + b __asm__("ebx"), // expected-error {{expected ';' at end of declaration}} + Statics:return; + } +} + // PR5825 struct test5 {}; ::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}} diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp new file mode 100644 index 00000000000..73aa3fdc403 --- /dev/null +++ b/clang/test/Parser/cxx0x-decl.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -std=c++0x %s + +// Make sure we know these are legitimate commas and not typos for ';'. +namespace Commas { + int a, + b [[ ]], + c alignas(double); +} |

