aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/FixIt/fixit-cxx0x.cpp6
-rw-r--r--test/FixIt/fixit.c7
-rw-r--r--test/FixIt/fixit.cpp13
-rw-r--r--test/Parser/cxx-decl.cpp32
-rw-r--r--test/Parser/cxx0x-decl.cpp8
5 files changed, 65 insertions, 1 deletions
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp
index 73316457b1..9fb647d03f 100644
--- a/test/FixIt/fixit-cxx0x.cpp
+++ b/test/FixIt/fixit-cxx0x.cpp
@@ -52,3 +52,9 @@ namespace Constexpr {
// -> constexpr static char *const p = 0;
};
}
+
+namespace SemiCommaTypo {
+ int m {},
+ n [[]], // expected-error {{expected ';' at end of declaration}}
+ int o;
+}
diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c
index 5ba0aac450..967ae23c18 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -70,3 +70,10 @@ void removeUnusedLabels(char c) {
: c++;
c = c + 3; L4: return;
}
+
+int oopsAComma = 0,
+void oopsMoreCommas() {
+ static int a[] = { 0, 1, 2 },
+ static int b[] = { 3, 4, 5 },
+ &a == &b ? oopsMoreCommas() : removeUnusedLabels(a[0]);
+}
diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp
index 96ce2ce097..dff8a37820 100644
--- a/test/FixIt/fixit.cpp
+++ b/test/FixIt/fixit.cpp
@@ -111,3 +111,16 @@ void foo1() const {} // expected-error {{type qualifier is not allowed on this f
void foo2() volatile {} // expected-error {{type qualifier is not allowed on this function}}
void foo3() const volatile {} // expected-error {{type qualifier is not allowed on this function}}
+struct S { void f(int, char); };
+int itsAComma,
+itsAComma2 = 0,
+oopsAComma(42), // expected-error {{expected ';' after declaration}}
+AD oopsMoreCommas() {
+ static int n = 0,
+ static char c,
+ &d = c, // expected-error {{expected ';' after declaration}}
+ S s, // expected-error {{expected ';' after declaration}}
+ s.f(n, d);
+ AD ad, // expected-error {{expected ';' after declaration}}
+ return ad;
+}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 70eff973e0..57f33d826f 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/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/test/Parser/cxx0x-decl.cpp b/test/Parser/cxx0x-decl.cpp
new file mode 100644
index 0000000000..73aa3fdc40
--- /dev/null
+++ b/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);
+}