summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/DelayedTemplateParsing.cpp4
-rw-r--r--test/Parser/MicrosoftExtensions.c9
-rw-r--r--test/Parser/MicrosoftExtensions.cpp29
-rw-r--r--test/Parser/altivec.c12
-rw-r--r--test/Parser/annotation-token-in-lexed-body.cpp5
-rw-r--r--test/Parser/atomic.c2
-rw-r--r--test/Parser/brackets.c8
-rw-r--r--test/Parser/brackets.cpp32
-rw-r--r--test/Parser/crash-report.c4
-rw-r--r--test/Parser/cxx-altivec.cpp24
-rw-r--r--test/Parser/cxx-ambig-init-templ.cpp1
-rw-r--r--test/Parser/cxx-class.cpp39
-rw-r--r--test/Parser/cxx0x-ambig.cpp4
-rw-r--r--test/Parser/cxx0x-attributes.cpp14
-rw-r--r--test/Parser/cxx0x-override-control-keywords.cpp6
-rw-r--r--test/Parser/extra-semi.cpp14
-rw-r--r--test/Parser/ms-inline-asm.c2
-rw-r--r--test/Parser/ms-seh.c24
-rw-r--r--test/Parser/no-gnu-inline-asm.c15
-rw-r--r--test/Parser/objcxx0x-lambda-expressions.mm13
-rw-r--r--test/Parser/opencl-atomics-cl20.cl56
-rw-r--r--test/Parser/recovery.cpp30
22 files changed, 294 insertions, 53 deletions
diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp
index eff3120..6ea245c 100644
--- a/test/Parser/DelayedTemplateParsing.cpp
+++ b/test/Parser/DelayedTemplateParsing.cpp
@@ -10,8 +10,8 @@ class A {
template <class T>
class B {
- void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
- void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}}
+ void foo4() { } // expected-note {{previous definition is here}}
+ void foo4() { } // expected-error {{class member cannot be redeclared}}
void foo5() { } // expected-note {{previous definition is here}}
friend void foo3() {
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index ea25ccd..40a9510 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -5,7 +5,7 @@ typedef int (__cdecl *tptr)(void);
void (*__fastcall fastpfunc)(void);
extern __declspec(dllimport) void __stdcall VarR4FromDec(void);
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
-__declspec(safebuffers) __declspec(noalias) __declspec(restrict) void * __cdecl xxx(void *_Memory); /* expected-warning{{__declspec attribute 'safebuffers' is not supported}} expected-warning{{__declspec attribute 'noalias' is not supported}} expected-warning{{__declspec attribute 'restrict' is not supported}} */
+__declspec(safebuffers) __declspec(noalias) __declspec(restrict) void * __cdecl xxx(void *_Memory); /* expected-warning{{__declspec attribute 'safebuffers' is not supported}} expected-warning{{__declspec attribute 'noalias' is not supported}} */
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
void * __ptr64 PtrToPtr64(const void *p) {
@@ -93,3 +93,10 @@ typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; // expected-war
typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; // expected-warning {{qualifiers after comma in declarator list are ignored}}
typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; // expected-warning {{qualifiers after comma in declarator list are ignored}}
typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6; // expected-warning {{qualifiers after comma in declarator list are ignored}}
+
+__declspec(align(16)) struct align_before_key1 {};
+__declspec(align(16)) struct align_before_key2 {} align_before_key2_var;
+__declspec(align(16)) struct align_before_key3 {} *align_before_key3_var;
+_Static_assert(__alignof(struct align_before_key1) == 16, "");
+_Static_assert(__alignof(struct align_before_key2) == 16, "");
+_Static_assert(__alignof(struct align_before_key3) == 16, "");
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index 73a1bb5..1686515 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple i386-mingw32 -std=c++11 -fsyntax-only -Wno-unused-getter-return-value -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
+// RUN: %clang_cc1 %s -triple i386-mingw32 -std=c++14 -fsyntax-only -Wno-unused-getter-return-value -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
/* Microsoft attribute tests */
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
@@ -339,7 +339,7 @@ void TestProperty() {
//expected-warning@+1 {{C++ operator 'and' (aka '&&') used as a macro name}}
#define and foo
-struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; // expected-warning{{__declspec attribute 'novtable' is not supported}}
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
typedef bool (__stdcall __stdcall *blarg)(int);
@@ -375,3 +375,28 @@ typedef void(*ignored_quals_dummy3)(), __stdcall ignored_quals3; // expected-war
typedef void(*ignored_quals_dummy4)(), __thiscall ignored_quals4; // expected-warning {{qualifiers after comma in declarator list are ignored}}
typedef void(*ignored_quals_dummy5)(), __cdecl ignored_quals5; // expected-warning {{qualifiers after comma in declarator list are ignored}}
typedef void(*ignored_quals_dummy6)(), __vectorcall ignored_quals6; // expected-warning {{qualifiers after comma in declarator list are ignored}}
+
+namespace {
+bool f(int);
+template <typename T>
+struct A {
+ constexpr A(T t) {
+ __assume(f(t)); // expected-warning{{the argument to '__assume' has side effects that will be discarded}}
+ }
+ constexpr bool g() { return false; }
+};
+constexpr A<int> h() {
+ A<int> b(0); // expected-note {{in instantiation of member function}}
+ return b;
+}
+static_assert(h().g() == false, "");
+}
+
+namespace {
+__declspec(align(16)) struct align_before_key1 {};
+__declspec(align(16)) struct align_before_key2 {} align_before_key2_var;
+__declspec(align(16)) struct align_before_key3 {} *align_before_key3_var;
+static_assert(__alignof(struct align_before_key1) == 16, "");
+static_assert(__alignof(struct align_before_key2) == 16, "");
+static_assert(__alignof(struct align_before_key3) == 16, "");
+}
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index d852511..4d3a773 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -20,7 +20,7 @@ __vector bool short vv_bs;
__vector bool int vv_bi;
__vector __bool char vv___bc;
__vector __bool short vv___bs;
-__vector __bool int vv_bi;
+__vector __bool int vv___bi;
__vector __pixel vv_p;
__vector pixel vv__p;
__vector int vf__r();
@@ -73,8 +73,12 @@ vector bool v_b; // expected-warning {{type specifier missing
vector __bool v___b; // expected-warning {{type specifier missing, defaults to 'int'}}
// These should have errors.
-__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}
-vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}
+__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}}
+vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}}
+__vector bool long long v_bll1; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+__vector __bool long long v_bll2; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+vector bool long long v_bll3; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+vector __bool long long v_bll4; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}}
vector long double v_ld4; // expected-error {{cannot use 'long double' with '__vector'}}
vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}}
@@ -83,14 +87,12 @@ vector bool pixel v_bp; // expected-error {{cannot use '__pixel' wi
vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}}
-vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
vector __bool float v___bf; // expected-error {{cannot use 'float' with '__vector bool'}}
vector __bool double v___bd; // expected-error {{cannot use 'double' with '__vector bool'}}
vector __bool pixel v___bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
vector __bool signed char v___bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
vector __bool unsigned int v___bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
vector __bool long v___bl; // expected-error {{cannot use 'long' with '__vector bool'}}
-vector __bool long long v___bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
// vector long is deprecated, but vector long long is not.
vector long long v_ll;
diff --git a/test/Parser/annotation-token-in-lexed-body.cpp b/test/Parser/annotation-token-in-lexed-body.cpp
new file mode 100644
index 0000000..bcc9de1
--- /dev/null
+++ b/test/Parser/annotation-token-in-lexed-body.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+struct S { // expected-note{{to match this}}
+ void f() { // expected-note{{to match this}}
+ // expected-error@+1{{expected '}'}} expected-error@+1{{expected '}'}} expected-error@+1{{expected ';'}}
+#pragma pack()
diff --git a/test/Parser/atomic.c b/test/Parser/atomic.c
index 07a83dd..e435518 100644
--- a/test/Parser/atomic.c
+++ b/test/Parser/atomic.c
@@ -36,3 +36,5 @@ typedef _Atomic(int __attribute__((vector_size(16)))) atomic_vector_int;
struct S
_Atomic atomic_s_no_missing_semicolon;
+
+int *const _Atomic atomic_return_type();
diff --git a/test/Parser/brackets.c b/test/Parser/brackets.c
index 2750d0e..a1003f3 100644
--- a/test/Parser/brackets.c
+++ b/test/Parser/brackets.c
@@ -7,7 +7,7 @@
void test1() {
int a[] = {0,1,1,2,3};
int []b = {0,1,4,9,16};
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int []b = {0,1,4,9,16};
// CHECK: {{^}} ~~ ^
// CHECK: {{^}} []
@@ -23,7 +23,7 @@ void test1() {
struct S {
int [1][1]x;
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [1][1]x;
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
@@ -53,7 +53,7 @@ void test3() {
// CHECK: {{^}} int [5] *;
// CHECK: {{^}} ^
// CHECK-NOT: fix-it
- // expected-error@-5{{brackets go after the identifier}}
+ // expected-error@-5{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [5] *;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ()[5]
@@ -62,7 +62,7 @@ void test3() {
// CHECK: fix-it:{{.*}}:{[[@LINE-11]]:12-[[@LINE-11]]:12}:")[5]"
int [5] * a;
- // expected-error@-1{{brackets go after the identifier}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the identifier}}
// CHECK: {{^}} int [5] * a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[5]
diff --git a/test/Parser/brackets.cpp b/test/Parser/brackets.cpp
index f418c11..6963a75 100644
--- a/test/Parser/brackets.cpp
+++ b/test/Parser/brackets.cpp
@@ -7,7 +7,7 @@
void test1() {
int a[] = {0,1,1,2,3};
int []b = {0,1,4,9,16};
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int []b = {0,1,4,9,16};
// CHECK: {{^}} ~~ ^
// CHECK: {{^}} []
@@ -21,7 +21,7 @@ void test1() {
int *f = b; // No undeclared identifer error here.
int[1] g[2];
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int[1] g[2];
// CHECK: {{^}} ~~~ ^
// CHECK: {{^}} [1]
@@ -31,7 +31,7 @@ void test1() {
void test2() {
int [3] (*a) = 0;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] (*a) = 0;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [3]
@@ -47,7 +47,7 @@ void test2() {
struct A {
static int [1][1]x;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} static int [1][1]x;
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
@@ -56,7 +56,7 @@ struct A {
};
int [1][1]A::x = { {42} };
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [1][1]A::x = { {42} };
// CHECK: {{^}} ~~~~~~ ^
// CHECK: {{^}} [1][1]
@@ -65,7 +65,7 @@ int [1][1]A::x = { {42} };
struct B { static int (*x)[5]; };
int [5] *B::x = 0;
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [5] *B::x = 0;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[5]
@@ -75,7 +75,7 @@ int [5] *B::x = 0;
void test3() {
int [3] *a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] *a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[3]
@@ -88,7 +88,7 @@ void test3() {
void test4() {
int [2] a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [2] a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [2]
@@ -96,7 +96,7 @@ void test4() {
// CHECK: fix-it:{{.*}}:{[[@LINE-6]]:12-[[@LINE-6]]:12}:"[2]"
int [2] &b = a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [2] &b = a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[2]
@@ -128,7 +128,7 @@ struct A {
static int arr[3];
};
int [3] ::test6::A::arr = {1,2,3};
-// expected-error@-1{{brackets go after the unqualified-id}}
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}}int [3] ::test6::A::arr = {1,2,3};
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} [3]
@@ -141,7 +141,7 @@ namespace test7 {
class A{};
void test() {
int [3] A::*a;
- // expected-error@-1{{brackets go after the unqualified-id}}
+ // expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
// CHECK: {{^}} int [3] A::*a;
// CHECK: {{^}} ~~~~ ^
// CHECK: {{^}} ( )[3]
@@ -150,4 +150,12 @@ void test() {
// CHECK: fix-it:{{.*}}:{[[@LINE-7]]:16-[[@LINE-7]]:16}:")[3]"
}
}
-// CHECK: 14 errors generated.
+
+namespace test8 {
+struct A {
+ static const char f[];
+};
+const char[] A::f = "f";
+// expected-error@-1{{brackets are not allowed here; to declare an array, place the brackets after the name}}
+}
+// CHECK: 15 errors generated.
diff --git a/test/Parser/crash-report.c b/test/Parser/crash-report.c
index 6f37062..ef65b88 100644
--- a/test/Parser/crash-report.c
+++ b/test/Parser/crash-report.c
@@ -1,6 +1,10 @@
// RUN: not --crash %clang_cc1 %s 2>&1 | FileCheck %s
// REQUIRES: crash-recovery
+// FIXME: CHECKs might be incompatible to win32.
+// Stack traces also require back traces.
+// REQUIRES: shell, backtrace
+
#prag\
ma clang __debug crash
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index f2ba28b6..ac20de2 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -18,6 +18,9 @@ __vector float vv_f;
__vector bool char vv_bc;
__vector bool short vv_bs;
__vector bool int vv_bi;
+__vector __bool char vv___bc;
+__vector __bool short vv___bs;
+__vector __bool int vv___bi;
__vector __pixel vv_p;
__vector pixel vv__p;
__vector int vf__r();
@@ -40,6 +43,9 @@ vector float v_f;
vector bool char v_bc;
vector bool short v_bs;
vector bool int v_bi;
+vector __bool char v___bc;
+vector __bool short v___bs;
+vector __bool int v___bi;
vector __pixel v_p;
vector pixel v__p;
vector int f__r();
@@ -65,8 +71,12 @@ __vector long double vv_ld; // expected-error {{cannot use 'long double'
vector long double v_ld; // expected-error {{cannot use 'long double' with '__vector'}}
// These should have errors.
-__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}
-vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}
+__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}}
+vector double v_d2; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on POWER7 or later)}}
+__vector bool long long v_bll1; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+__vector __bool long long v_bll2; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+vector bool long long v_bll3; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
+vector __bool long long v_bll4; // expected-error {{use of 'long long' with '__vector bool' requires VSX support (available on POWER7 or later) or extended Altivec support (available on POWER8 or later) to be enabled}}
__vector long double vv_ld3; // expected-error {{cannot use 'long double' with '__vector'}}
vector long double v_ld4; // expected-error {{cannot use 'long double' with '__vector'}}
vector bool v_b; // expected-error {{C++ requires a type specifier for all declarations}}
@@ -74,9 +84,14 @@ vector bool float v_bf; // expected-error {{cannot use 'float' with
vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}}
vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
-vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}}
-vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
+vector __bool float v___bf; // expected-error {{cannot use 'float' with '__vector bool'}}
+vector __bool double v___bd; // expected-error {{cannot use 'double' with '__vector bool'}}
+vector __bool pixel v___bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
+vector __bool signed char v___bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
+vector __bool unsigned int v___bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector __bool long v___bl; // expected-error {{cannot use 'long' with '__vector bool'}}
// vector long is deprecated, but vector long long is not.
vector long long v_ll;
@@ -179,3 +194,4 @@ public:
template<typename... Args> void PR16874() {
(void) (Args::foo()...); // expected-error {{expression contains unexpanded parameter pack 'Args'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
}
+
diff --git a/test/Parser/cxx-ambig-init-templ.cpp b/test/Parser/cxx-ambig-init-templ.cpp
index 1f69266..89ed5e5 100644
--- a/test/Parser/cxx-ambig-init-templ.cpp
+++ b/test/Parser/cxx-ambig-init-templ.cpp
@@ -160,7 +160,6 @@ namespace Operators {
namespace ElaboratedTypeSpecifiers {
struct S {
int f(int x = T<a, struct S>());
- int g(int x = T<a, class __declspec() C>());
int h(int x = T<a, union __attribute__(()) U>());
int i(int x = T<a, enum E>());
int j(int x = T<a, struct S::template T<0, enum E>>());
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index 0e9a3b9..38eef17 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -140,8 +140,8 @@ namespace CtorErrors {
}
namespace DtorErrors {
- struct A { ~A(); } a;
- ~A::A() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}}
+ struct A { ~A(); int n; } a;
+ ~A::A() { n = 0; } // expected-error {{'~' in destructor name should be after nested name specifier}} expected-note {{previous}}
A::~A() {} // expected-error {{redefinition}}
struct B { ~B(); } *b;
@@ -151,6 +151,35 @@ namespace DtorErrors {
a.~A::A(); // expected-error {{'~' in destructor name should be after nested name specifier}}
b->~DtorErrors::~B::B(); // expected-error {{'~' in destructor name should be after nested name specifier}}
}
+
+ struct C; // expected-note {{forward decl}}
+ ~C::C() {} // expected-error {{incomplete}} expected-error {{'~' in destructor name should be after nested name specifier}}
+
+ struct D { struct X {}; ~D() throw(X); };
+ ~D::D() throw(X) {} // expected-error {{'~' in destructor name should be after nested name specifier}}
+
+ ~Undeclared::Undeclared() {} // expected-error {{use of undeclared identifier 'Undeclared'}} expected-error {{'~' in destructor name should be after nested name specifier}}
+ ~Undeclared:: {} // expected-error {{expected identifier}} expected-error {{'~' in destructor name should be after nested name specifier}}
+
+ struct S {
+ // For another struct's destructor, emit the same diagnostic like for
+ // A::~A() in addition to the "~ in the wrong place" one.
+ ~A::A() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{non-friend class member '~A' cannot have a qualified name}}
+ A::~A() {} // expected-error {{non-friend class member '~A' cannot have a qualified name}}
+
+ // An inline destructor with a redundant class name should also get the
+ // same diagnostic as S::~S.
+ ~S::S() {} // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{extra qualification on member '~S'}}
+
+ // This just shouldn't crash.
+ int I; // expected-note {{declared here}}
+ ~I::I() {} // expected-error {{'I' is not a class, namespace, or enumeration}} expected-error {{'~' in destructor name should be after nested name specifier}}
+ };
+
+ struct T {};
+ T t1 = t1.T::~T<int>; // expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}}
+ // Emit the same diagnostic as for the previous case, plus something about ~.
+ T t2 = t2.~T::T<int>; // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}}
}
namespace BadFriend {
@@ -181,9 +210,9 @@ class X2 { a::a; }; // expected-error {{undeclared identifier 'a'}}
class BadExceptionSpec {
void f() throw(int; // expected-error {{expected ')'}} expected-note {{to match}}
- void g() throw( // expected-note {{to match}}
- int( // expected-note {{to match}}
- ; // expected-error 2{{expected ')'}} expected-error {{unexpected end of exception specification}}
+ void g() throw(
+ int(
+ ; // expected-error {{unexpected ';' before ')'}}
));
};
diff --git a/test/Parser/cxx0x-ambig.cpp b/test/Parser/cxx0x-ambig.cpp
index b06f432..a47585f 100644
--- a/test/Parser/cxx0x-ambig.cpp
+++ b/test/Parser/cxx0x-ambig.cpp
@@ -110,8 +110,8 @@ namespace ellipsis {
template<typename...T>
struct S {
void e(S::S());
- void f(S(...args[sizeof(T)])); // expected-note {{here}}
- void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}} expected-note {{here}}
+ void f(S(...args[sizeof(T)])); // expected-note {{here}} expected-note {{here}}
+ void f(S(...args)[sizeof(T)]); // expected-error {{redeclared}}
void f(S ...args[sizeof(T)]); // expected-error {{redeclared}}
void g(S(...[sizeof(T)])); // expected-note {{here}} expected-warning {{ISO C++11 requires a parenthesized pack declaration to have a name}}
void g(S(...)[sizeof(T)]); // expected-error {{function cannot return array type}}
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index c68a119..7eec576 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -288,6 +288,7 @@ namespace arguments {
void f[[gnu::format(printf, 1, 2)]](const char*, ...);
void g() [[unknown::foo(ignore arguments for unknown attributes, even with symbols!)]]; // expected-warning {{unknown attribute 'foo' ignored}}
[[deprecated("with argument")]] int i;
+ // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}}
}
// Forbid attributes on decl specifiers.
@@ -330,8 +331,12 @@ namespace GccASan {
namespace {
[[deprecated]] void bar();
+ // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}}
[[deprecated("hello")]] void baz();
- [[deprecated()]] void foo(); // expected-error {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}}
+ // expected-warning@-1 {{use of the 'deprecated' attribute is a C++14 extension}}
+ [[deprecated()]] void foo();
+ // expected-error@-1 {{parentheses must be omitted if 'deprecated' attribute's argument list is empty}}
+ // expected-warning@-2 {{use of the 'deprecated' attribute is a C++14 extension}}
[[gnu::deprecated()]] void quux();
}
@@ -341,3 +346,10 @@ namespace {
deprecated
]] void bad();
}
+
+#define attr_name bitand
+#define attr_name_2(x) x
+#define attr_name_3(x, y) x##y
+[[attr_name, attr_name_2(bitor), attr_name_3(com, pl)]] int macro_attrs; // expected-warning {{unknown attribute 'compl' ignored}} \
+ expected-warning {{unknown attribute 'bitor' ignored}} \
+ expected-warning {{unknown attribute 'bitand' ignored}}
diff --git a/test/Parser/cxx0x-override-control-keywords.cpp b/test/Parser/cxx0x-override-control-keywords.cpp
index be79db3..a9096af 100644
--- a/test/Parser/cxx0x-override-control-keywords.cpp
+++ b/test/Parser/cxx0x-override-control-keywords.cpp
@@ -10,10 +10,8 @@ struct S : Base {
virtual void override() override;
};
-struct T {
- // virt-specifier-seq is only valid in member-declarators, and a function definition is not a member-declarator.
- // FIXME: This currently doesn't work.
- // virtual void f() const override { }
+struct T : Base {
+ virtual void override() override { }
};
struct override;
diff --git a/test/Parser/extra-semi.cpp b/test/Parser/extra-semi.cpp
new file mode 100644
index 0000000..1a44dae
--- /dev/null
+++ b/test/Parser/extra-semi.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: cp %s %t.cpp
+// RUN: not %clang_cc1 -fsyntax-only %t.cpp -fixit
+// RUN: %clang_cc1 -fsyntax-only %t.cpp
+
+void test1(int a;) { // expected-error{{unexpected ';' before ')'}}
+ while (a > 5;) {} // expected-error{{unexpected ';' before ')'}}
+ if (int b = 10;) {} // expected-error{{unexpected ';' before ')'}}
+ for (int c = 0; c < 21; ++c;) {} // expected-error{{unexpected ';' before ')'}}
+ int d = int(3 + 4;); // expected-error{{unexpected ';' before ')'}}
+ int e[5;]; // expected-error{{unexpected ';' before ']'}}
+ e[a+1;] = 4; // expected-error{{unexpected ';' before ']'}}
+ int f[] = {1,2,3;}; // expected-error{{unexpected ';' before '}'}}
+}
diff --git a/test/Parser/ms-inline-asm.c b/test/Parser/ms-inline-asm.c
index 72c96c3..6dde5f5 100644
--- a/test/Parser/ms-inline-asm.c
+++ b/test/Parser/ms-inline-asm.c
@@ -1,5 +1,7 @@
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
+// Disabling gnu inline assembly should have no effect on this testcase
+// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm
#define M __asm int 0x2c
#define M2 int
diff --git a/test/Parser/ms-seh.c b/test/Parser/ms-seh.c
new file mode 100644
index 0000000..68c2e30
--- /dev/null
+++ b/test/Parser/ms-seh.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
+
+void f() {
+ int a;
+
+ __try a; // expected-error {{expected '{'}} expected-warning {{expression result unused}}
+
+ __try {
+ }
+} // expected-error {{expected '__except' or '__finally' block}}
+
+void g() {
+ int a;
+
+ __try {
+ } __except(1) a; // expected-error {{expected '{'}} expected-warning {{expression result unused}}
+}
+
+void h() {
+ int a;
+
+ __try {
+ } __finally a; // expected-error {{expected '{'}} expected-warning {{expression result unused}}
+}
diff --git a/test/Parser/no-gnu-inline-asm.c b/test/Parser/no-gnu-inline-asm.c
new file mode 100644
index 0000000..03c2ede
--- /dev/null
+++ b/test/Parser/no-gnu-inline-asm.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -triple i686-apple-darwin -verify -fsyntax-only -fno-gnu-inline-asm
+
+asm ("INST r1, 0"); // expected-error {{GNU-style inline assembly is disabled}}
+
+void foo() __asm("__foo_func"); // AsmLabel is OK
+int foo1 asm("bar1") = 0; // OK
+
+asm(" "); // Whitespace is OK
+
+void f (void) {
+ long long foo = 0, bar;
+ asm volatile("INST %0, %1" : "=r"(foo) : "r"(bar)); // expected-error {{GNU-style inline assembly is disabled}}
+ asm (""); // Empty is OK
+ return;
+}
diff --git a/test/Parser/objcxx0x-lambda-expressions.mm b/test/Parser/objcxx0x-lambda-expressions.mm
index 3954a80..c6ed121 100644
--- a/test/Parser/objcxx0x-lambda-expressions.mm
+++ b/test/Parser/objcxx0x-lambda-expressions.mm
@@ -41,3 +41,16 @@ class C {
};
+struct Func {
+ template <typename F>
+ Func(F&&);
+};
+
+int getInt();
+
+void test() {
+ [val = getInt()]() { };
+ Func{
+ [val = getInt()]() { }
+ };
+}
diff --git a/test/Parser/opencl-atomics-cl20.cl b/test/Parser/opencl-atomics-cl20.cl
new file mode 100644
index 0000000..65cc6f8
--- /dev/null
+++ b/test/Parser/opencl-atomics-cl20.cl
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -verify -pedantic -fsyntax-only
+// RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20
+// RUN: %clang_cc1 %s -triple x86_64-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT
+
+#ifdef EXT
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics:enable
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics:enable
+#pragma OPENCL EXTENSION cl_khr_fp64:enable
+#endif
+
+void atomic_types_test() {
+// OpenCL v2.0 s6.13.11.6 defines supported atomic types.
+ atomic_int i;
+ atomic_uint ui;
+ atomic_long l;
+ atomic_ulong ul;
+ atomic_float f;
+ atomic_double d;
+ atomic_flag fl;
+ atomic_intptr_t ip;
+ atomic_uintptr_t uip;
+ atomic_size_t s;
+ atomic_ptrdiff_t pd;
+// OpenCL v2.0 s6.13.11.8, _Atomic type specifier and _Atomic type qualifier
+// are not supported by OpenCL.
+ _Atomic int i; // expected-error {{use of undeclared identifier '_Atomic'}}
+}
+#ifndef CL20
+// expected-error@-16 {{use of undeclared identifier 'atomic_int'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_uint'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_long'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_ulong'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_float'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_double'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_flag'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_intptr_t'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_uintptr_t'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_size_t'}}
+// expected-error@-16 {{use of undeclared identifier 'atomic_ptrdiff_t'}}
+#elif !EXT
+// expected-error@-26 {{use of type 'atomic_long' (aka '_Atomic(long)') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error@-27 {{use of type 'atomic_long' (aka '_Atomic(long)') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error@-27 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error@-28 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error@-27 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error@-28 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error@-29 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_fp64 extension to be enabled}}
+// expected-error-re@-28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-29 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-29 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-30 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-30 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-31 {{use of type 'atomic_size_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+// expected-error-re@-31 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
+// expected-error-re@-32 {{use of type 'atomic_ptrdiff_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
+#endif
diff --git a/test/Parser/recovery.cpp b/test/Parser/recovery.cpp
index 5608b50..2d5b518 100644
--- a/test/Parser/recovery.cpp
+++ b/test/Parser/recovery.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -std=c++11 %s
+// RUN: %clang_cc1 -verify -std=c++11 -fms-extensions %s
8gi///===--- recovery.cpp ---===// // expected-error {{unqualified-id}}
namespace Std { // expected-note {{here}}
@@ -154,17 +154,17 @@ namespace pr15133 {
void func_1(int x) {
switch(x) {
case 0: break;
- case ns::V1:: break; // expected-error{{'V1' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
- case C1::V2:: break; // expected-error{{'V2' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
- case C1::V3:: break; // expected-error{{'V3' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
- case V4:: break; // expected-error{{'V4' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
- case V6:: func_3(); // expected-error{{'V6' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
+ case ns::V1:: break; // expected-error{{'V1' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
+ case C1::V2:: break; // expected-error{{'V2' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
+ case C1::V3:: break; // expected-error{{'V3' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
+ case V4:: break; // expected-error{{'V4' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
+ case V6:: func_3(); // expected-error{{'V6' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
}
}
void func_2(EC3 x) {
switch(x) {
case EC3::V0: break;
- case EC3::V5:: break; // expected-error{{'V5' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
+ case EC3::V5:: break; // expected-error{{'V5' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
}
}
@@ -186,13 +186,13 @@ namespace pr15133 {
};
int func_3(int x) {
- return x ? S::n :: 0; // expected-error{{'n' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
+ return x ? S::n :: 0; // expected-error{{'n' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
}
int func_4(int x, S &s) {
- return x ? s.nn :: x; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
+ return x ? s.nn :: x; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
}
int func_5(int x, S &s) {
- return x ? s.nn :: S::n; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or scoped enumeration; did you mean ':'?}}
+ return x ? s.nn :: S::n; // expected-error{{'nn' cannot appear before '::' because it is not a class, namespace, or enumeration; did you mean ':'?}}
}
struct S2 {
@@ -202,3 +202,13 @@ namespace pr15133 {
struct S2 :: S3 :: public S2 { // expected-error{{'public' cannot be a part of nested name specifier; did you mean ':'?}}
};
}
+
+namespace InvalidEmptyNames {
+// These shouldn't crash, the diagnostics aren't important.
+struct ::, struct ::; // expected-error 2 {{expected identifier}} expected-error 2 {{declaration of anonymous struct must be a definition}} expected-warning {{declaration does not declare anything}}
+enum ::, enum ::; // expected-error 2 {{expected identifier}} expected-warning {{declaration does not declare anything}}
+struct ::__super, struct ::__super; // expected-error 2 {{expected identifier}} expected-error 2 {{expected '::' after '__super'}}
+struct ::template foo, struct ::template bar; // expected-error 2 {{expected identifier}} expected-error 2 {{declaration of anonymous struct must be a definition}} expected-warning {{declaration does not declare anything}}
+struct ::foo struct::; // expected-error {{no struct named 'foo' in the global namespace}} expected-error {{expected identifier}} expected-error {{declaration of anonymous struct must be a definition}}
+class :: : {} a; // expected-error {{expected identifier}} expected-error {{expected class name}}
+}
OpenPOWER on IntegriCloud