aboutsummaryrefslogtreecommitdiff
path: root/test/Parser
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:02:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:02:28 +0000
commit7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch)
treec72b9241553fc9966179aba84f90f17bfa9235c3 /test/Parser
parentb52119637f743680a99710ce5fdb6646da2772af (diff)
Notes
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/altivec-csk-bool.c4
-rw-r--r--test/Parser/altivec.c6
-rw-r--r--test/Parser/attr-external-source-symbol-cxx11.cpp5
-rw-r--r--test/Parser/attr-external-source-symbol.m84
-rw-r--r--test/Parser/backtrack-off-by-one.cpp9
-rw-r--r--test/Parser/cxx-altivec.cpp6
-rw-r--r--test/Parser/cxx-template-decl.cpp10
-rw-r--r--test/Parser/cxx0x-ambig.cpp2
-rw-r--r--test/Parser/cxx0x-attributes.cpp10
-rw-r--r--test/Parser/cxx11-stmt-attributes.cpp1
-rw-r--r--test/Parser/cxx1z-class-template-argument-deduction.cpp194
-rw-r--r--test/Parser/declspec-recovery.c8
-rw-r--r--test/Parser/declspec-supported.c10
-rw-r--r--test/Parser/eof.cpp2
-rw-r--r--test/Parser/objc-available.m5
-rw-r--r--test/Parser/objc-cxx-keyword-identifiers.mm62
-rw-r--r--test/Parser/opencl-atomics-cl20.cl2
-rw-r--r--test/Parser/pragma-fp.cpp64
-rw-r--r--test/Parser/vector-cast-define.cl10
-rw-r--r--test/Parser/vsx.c4
20 files changed, 479 insertions, 19 deletions
diff --git a/test/Parser/altivec-csk-bool.c b/test/Parser/altivec-csk-bool.c
index c1c253958c668..dc7fa1da3952a 100644
--- a/test/Parser/altivec-csk-bool.c
+++ b/test/Parser/altivec-csk-bool.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -faltivec -fsyntax-only %s
-// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only %s
// PR16456: Verify that bool, true, false are treated as context-sensitive
// keywords (and therefore available for use as identifiers) when in
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index 4d3a7730c35d6..769b4dec98fcf 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify %s
__vector char vv_c;
__vector signed char vv_sc;
diff --git a/test/Parser/attr-external-source-symbol-cxx11.cpp b/test/Parser/attr-external-source-symbol-cxx11.cpp
new file mode 100644
index 0000000000000..3457c6a8f430a
--- /dev/null
+++ b/test/Parser/attr-external-source-symbol-cxx11.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// expected-no-diagnostics
+
+[[clang::external_source_symbol(language="Swift", defined_in="module")]]
+void function() { }
diff --git a/test/Parser/attr-external-source-symbol.m b/test/Parser/attr-external-source-symbol.m
new file mode 100644
index 0000000000000..772fde0d48c96
--- /dev/null
+++ b/test/Parser/attr-external-source-symbol.m
@@ -0,0 +1,84 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void function() __attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration)));
+
+__attribute__((external_source_symbol(language="Swift", defined_in="module")))
+@interface I
+
+- (void)method __attribute__((external_source_symbol(defined_in= "module")));
+
+@end
+
+enum E {
+ CaseA __attribute__((external_source_symbol(generated_declaration))),
+ CaseB __attribute__((external_source_symbol(generated_declaration, language="Swift")))
+} __attribute__((external_source_symbol(language = "Swift")));
+
+void f2()
+__attribute__((external_source_symbol())); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+void f3()
+__attribute__((external_source_symbol(invalid))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+void f4()
+__attribute__((external_source_symbol(language))); // expected-error {{expected '=' after language}}
+void f5()
+__attribute__((external_source_symbol(language=))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
+void f6()
+__attribute__((external_source_symbol(defined_in=20))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}}
+
+void f7()
+__attribute__((external_source_symbol(generated_declaration, generated_declaration))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}}
+void f8()
+__attribute__((external_source_symbol(language="Swift", language="Swift"))); // expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}}
+void f9()
+__attribute__((external_source_symbol(defined_in="module", language="Swift", defined_in="foo"))); // expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}}
+
+void f10()
+__attribute__((external_source_symbol(generated_declaration, language="Swift", defined_in="foo", generated_declaration, generated_declaration, language="Swift"))); // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}}
+
+void f11()
+__attribute__((external_source_symbol(language="Objective-C++", defined_in="Some file with spaces")));
+
+void f12()
+__attribute__((external_source_symbol(language="C Sharp", defined_in="file:////Hello world with spaces. cs")));
+
+void f13()
+__attribute__((external_source_symbol(language=Swift))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
+
+void f14()
+__attribute__((external_source_symbol(=))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+
+void f15()
+__attribute__((external_source_symbol(="Swift"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+
+void f16()
+__attribute__((external_source_symbol("Swift", "module", generated_declaration))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+
+void f17()
+__attribute__((external_source_symbol(language="Swift", "generated_declaration"))); // expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
+
+void f18()
+__attribute__((external_source_symbol(language= =))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
+
+void f19()
+__attribute__((external_source_symbol(defined_in="module" language="swift"))); // expected-error {{expected ')'}} expected-note {{to match this '('}}
+
+void f20()
+__attribute__((external_source_symbol(defined_in="module" language="swift" generated_declaration))); // expected-error {{expected ')'}} expected-note {{to match this '('}}
+
+void f21()
+__attribute__((external_source_symbol(defined_in= language="swift"))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}}
+
+void f22()
+__attribute__((external_source_symbol)); // expected-error {{'external_source_symbol' attribute takes at least 1 argument}}
+
+void f23()
+__attribute__((external_source_symbol(defined_in=, language="swift" generated_declaration))); // expected-error {{expected string literal for source container name in 'external_source_symbol' attribute}} expected-error{{expected ')'}} expected-note{{to match this '('}}
+
+void f24()
+__attribute__((external_source_symbol(language = generated_declaration))); // expected-error {{expected string literal for language name in 'external_source_symbol' attribute}}
+
+void f25()
+__attribute__((external_source_symbol(defined_in=123, defined_in="module"))); // expected-error {{expected string literal for source container name in 'external_source_symbol'}} expected-error {{duplicate 'defined_in' clause in an 'external_source_symbol' attribute}}
+
+void f26()
+__attribute__((external_source_symbol(language=Swift, language="Swift", error))); // expected-error {{expected string literal for language name in 'external_source_symbol'}} expected-error {{duplicate 'language' clause in an 'external_source_symbol' attribute}} expected-error {{expected 'language', 'defined_in', or 'generated_declaration'}}
diff --git a/test/Parser/backtrack-off-by-one.cpp b/test/Parser/backtrack-off-by-one.cpp
index efb95a5a225d4..52e1c41478393 100644
--- a/test/Parser/backtrack-off-by-one.cpp
+++ b/test/Parser/backtrack-off-by-one.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -verify %s
// RUN: %clang_cc1 -verify %s -std=c++98
// RUN: %clang_cc1 -verify %s -std=c++11
+// RUN: %clang_cc1 -verify %s -std=c++1z
// PR25946
// We had an off-by-one error in an assertion when annotating A<int> below. Our
@@ -13,9 +14,13 @@ template <typename T> class A {};
// expected-error@+1 {{expected '{' after base class list}}
template <typename T> class B : T // not ',' or '{'
#if __cplusplus < 201103L
-// expected-error@+4 {{expected ';' after top level declarator}}
+// expected-error@+8 {{expected ';' after top level declarator}}
+#endif
+#if __cplusplus <= 201402L
+// expected-error@+5 {{C++ requires a type specifier for all declarations}}
+#else
+// expected-error@+3 {{expected unqualified-id}}
#endif
-// expected-error@+2 {{C++ requires a type specifier for all declarations}}
// expected-error@+1 {{expected ';' after class}}
A<int> {
};
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index 5b0da6c5e6fd9..6395452010d45 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -fsyntax-only -verify -std=c++11 %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -target-feature +altivec -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -fsyntax-only -verify -std=c++11 %s
#include <altivec.h>
__vector char vv_c;
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp
index efa42ad30d049..9ad422e7ab718 100644
--- a/test/Parser/cxx-template-decl.cpp
+++ b/test/Parser/cxx-template-decl.cpp
@@ -238,3 +238,13 @@ struct t2 : base<int,
// expected-error@-1 {{expected '{' after base class list}}
}
+
+namespace class_scope_instantiation {
+ struct A {
+ template<typename T> void f(T);
+ template void f<int>(int); // expected-error {{expected '<' after 'template'}}
+ template void f(float); // expected-error {{expected '<' after 'template'}}
+ extern template // expected-error {{expected member name or ';'}}
+ void f(double);
+ };
+}
diff --git a/test/Parser/cxx0x-ambig.cpp b/test/Parser/cxx0x-ambig.cpp
index a47585f8b6435..4a1b4ad777a68 100644
--- a/test/Parser/cxx0x-ambig.cpp
+++ b/test/Parser/cxx0x-ambig.cpp
@@ -109,7 +109,7 @@ namespace trailing_return {
namespace ellipsis {
template<typename...T>
struct S {
- void e(S::S());
+ void e(S::S()); // expected-error {{is a constructor name}}
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}}
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index 906d72b087cb5..647762f165cb8 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -99,11 +99,13 @@ void fn_with_structs() {
}
[[]];
struct ctordtor {
- [[]] ctordtor();
- [[]] ~ctordtor();
+ [[]] ctordtor [[]] () [[]];
+ ctordtor (C) [[]];
+ [[]] ~ctordtor [[]] () [[]];
};
-[[]] ctordtor::ctordtor() {}
-[[]] ctordtor::~ctordtor() {}
+[[]] ctordtor::ctordtor [[]] () [[]] {}
+[[]] ctordtor::ctordtor (C) [[]] try {} catch (...) {}
+[[]] ctordtor::~ctordtor [[]] () [[]] {}
extern "C++" [[]] int extern_attr;
template <typename T> [[]] void template_attr ();
[[]] [[]] int [[]] [[]] multi_attr [[]] [[]];
diff --git a/test/Parser/cxx11-stmt-attributes.cpp b/test/Parser/cxx11-stmt-attributes.cpp
index 9374b58b1f240..75fb37ea9fb44 100644
--- a/test/Parser/cxx11-stmt-attributes.cpp
+++ b/test/Parser/cxx11-stmt-attributes.cpp
@@ -80,5 +80,6 @@ void foo(int i) {
{
[[ ]] // expected-error {{an attribute list cannot appear here}}
#pragma STDC FP_CONTRACT ON // expected-error {{can only appear at file scope or at the start of a compound statement}}
+#pragma clang fp contract(fast) // expected-error {{can only appear at file scope or at the start of a compound statement}}
}
}
diff --git a/test/Parser/cxx1z-class-template-argument-deduction.cpp b/test/Parser/cxx1z-class-template-argument-deduction.cpp
new file mode 100644
index 0000000000000..dac17dfbf480e
--- /dev/null
+++ b/test/Parser/cxx1z-class-template-argument-deduction.cpp
@@ -0,0 +1,194 @@
+// RUN: %clang_cc1 -std=c++1z -fcxx-exceptions -verify %s
+
+template <typename T> struct A { // expected-note 35{{declared here}}
+ constexpr A() {}
+ constexpr A(int) {}
+ constexpr operator int() { return 0; }
+};
+A() -> A<int>;
+A(int) -> A<int>;
+
+// Make sure we still correctly parse cases where a template can appear without arguments.
+namespace template_template_arg {
+ template<template<typename> typename> struct X {};
+ template<typename> struct Y {};
+
+ X<A> xa;
+ Y<A> ya; // expected-error {{requires template arguments}}
+ X<::A> xcca;
+ Y<::A> ycca; // expected-error {{requires template arguments}}
+
+ template<template<typename> typename = A> struct XD {};
+ template<typename = A> struct YD {}; // expected-error {{requires template arguments}}
+ template<template<typename> typename = ::A> struct XCCD {};
+ template<typename = ::A> struct YCCD {}; // expected-error {{requires template arguments}}
+
+ // FIXME: replacing the invalid type with 'int' here is horrible
+ template <A a = A<int>()> class C { }; // expected-error {{requires template arguments}}
+ template<typename T = A> struct G { }; // expected-error {{requires template arguments}}
+}
+
+namespace injected_class_name {
+ template<typename T> struct A {
+ A(T);
+ void f(int) { // expected-note {{previous}}
+ A a = 1;
+ injected_class_name::A b = 1; // expected-note {{in instantiation of template class 'injected_class_name::A<int>'}}
+ }
+ void f(T); // expected-error {{multiple overloads of 'f' instantiate to the same signature 'void (int)}}
+ };
+ A<short> ai = 1;
+ A<double>::A b(1); // expected-error {{constructor name}}
+}
+
+struct member {
+ A a; // expected-error {{requires template arguments}}
+ A *b; // expected-error {{requires template arguments}}
+ const A c; // expected-error {{requires template arguments}}
+
+ void f() throw (A); // expected-error {{requires template arguments}}
+
+ friend A; // expected-error {{requires template arguments; argument deduction not allowed in friend declaration}}
+
+ operator A(); // expected-error {{requires template arguments; argument deduction not allowed in conversion function type}}
+
+ static A x; // expected-error {{declaration of variable 'x' with deduced type 'A' requires an initializer}}
+ static constexpr A y = 0;
+};
+
+namespace in_typedef {
+ typedef A *AutoPtr; // expected-error {{requires template arguments; argument deduction not allowed in typedef}}
+ typedef A (*PFun)(int a); // expected-error{{requires template arguments; argument deduction not allowed in typedef}}
+ typedef A Fun(int a) -> decltype(a + a); // expected-error{{requires template arguments; argument deduction not allowed in function return type}}
+}
+
+namespace stmt {
+ void g(A a) { // expected-error{{requires template arguments; argument deduction not allowed in function prototype}}
+ try { }
+ catch (A &a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}}
+ catch (const A a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}}
+ try { } catch (A a) { } // expected-error{{requires template arguments; argument deduction not allowed in exception declaration}}
+
+ // FIXME: The standard only permits class template argument deduction in a
+ // simple-declaration or cast. We also permit it in conditions,
+ // for-range-declarations, member-declarations for static data members, and
+ // new-expressions, because not doing so would be bizarre.
+ A local = 0;
+ static A local_static = 0;
+ static thread_local A thread_local_static = 0;
+ if (A a = 0) {}
+ if (A a = 0; a) {}
+ switch (A a = 0) {} // expected-warning {{no case matching constant switch condition '0'}}
+ switch (A a = 0; a) {} // expected-warning {{no case matching constant switch condition '0'}}
+ for (A a = 0; a; /**/) {}
+ for (/**/; A a = 0; /**/) {}
+ while (A a = 0) {}
+ int arr[3];
+ for (A a : arr) {}
+ }
+
+ namespace std {
+ class type_info;
+ }
+}
+
+namespace expr {
+ template<typename T> struct U {};
+ void j() {
+ (void)typeid(A); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)sizeof(A); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)__alignof(A); // expected-error{{requires template arguments; argument deduction not allowed here}}
+
+ U<A> v; // expected-error {{requires template arguments}}
+
+ int n;
+ (void)dynamic_cast<A&>(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)static_cast<A*>(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)reinterpret_cast<A*>(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)const_cast<A>(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)*(A*)(&n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)(A)(n); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)(A){n}; // expected-error{{requires template arguments; argument deduction not allowed here}}
+
+ (void)A(n);
+ (void)A{n};
+ (void)new A(n);
+ (void)new A{n};
+ // FIXME: We should diagnose the lack of an initializer here.
+ (void)new A;
+ }
+}
+
+namespace decl {
+ enum E : A {}; // expected-error{{requires template arguments; argument deduction not allowed here}}
+ struct F : A {}; // expected-error{{expected class name}}
+
+ using B = A; // expected-error{{requires template arguments}}
+
+ auto k() -> A; // expected-error{{requires template arguments}}
+
+ A a; // expected-error {{declaration of variable 'a' with deduced type 'A' requires an initializer}}
+ A b = 0;
+ const A c = 0;
+ A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
+ A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
+ A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}
+ A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}
+ A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
+ A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}
+ A [x, y] = 0; // expected-error {{cannot be declared with type 'A'}} expected-error {{type 'A<int>' decomposes into 0 elements, but 2 names were provided}}
+}
+
+namespace typename_specifier {
+ struct F {};
+
+ void e() {
+ (void) typename ::A(0);
+ (void) typename ::A{0};
+ new typename ::A(0);
+ new typename ::A{0};
+ typename ::A a = 0;
+ const typename ::A b = 0;
+ if (typename ::A a = 0) {}
+ for (typename ::A a = 0; typename ::A b = 0; /**/) {}
+
+ (void)(typename ::A)(0); // expected-error{{requires template arguments; argument deduction not allowed here}}
+ (void)(typename ::A){0}; // expected-error{{requires template arguments; argument deduction not allowed here}}
+ }
+ typename ::A a = 0;
+ const typename ::A b = 0;
+ typename ::A (parens) = 0; // expected-error {{cannot use parentheses when declaring variable with deduced class template specialization type}}
+ typename ::A *p = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
+ typename ::A &r = *p; // expected-error {{cannot form reference to deduced class template specialization type}}
+ typename ::A arr[3] = 0; // expected-error {{cannot form array of deduced class template specialization type}}
+ typename ::A F::*pm = 0; // expected-error {{cannot form pointer to deduced class template specialization type}}
+ typename ::A (*fp)() = 0; // expected-error {{cannot form function returning deduced class template specialization type}}
+ typename ::A [x, y] = 0; // expected-error {{cannot be declared with type 'typename ::A'}} expected-error {{type 'typename ::A<int>' (aka 'A<int>') decomposes into 0}}
+
+ struct X { template<typename T> struct A { A(T); }; }; // expected-note 8{{declared here}}
+
+ template<typename T> void f() {
+ (void) typename T::A(0);
+ (void) typename T::A{0};
+ new typename T::A(0);
+ new typename T::A{0};
+ typename T::A a = 0;
+ const typename T::A b = 0;
+ if (typename T::A a = 0) {} // expected-error {{value of type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') is not contextually convertible to 'bool'}}
+ for (typename T::A a = 0; typename T::A b = 0; /**/) {} // expected-error {{value of type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') is not contextually convertible to 'bool'}}
+
+ {(void)(typename T::A)(0);} // expected-error{{refers to class template member}}
+ {(void)(typename T::A){0};} // expected-error{{refers to class template member}}
+ {typename T::A (parens) = 0;} // expected-error {{refers to class template member in 'typename_specifier::X'; argument deduction not allowed here}}
+ {typename T::A *p = 0;} // expected-error {{refers to class template member}}
+ {typename T::A &r = *p;} // expected-error {{refers to class template member}}
+ {typename T::A arr[3] = 0;} // expected-error {{refers to class template member}}
+ {typename T::A F::*pm = 0;} // expected-error {{refers to class template member}}
+ {typename T::A (*fp)() = 0;} // expected-error {{refers to class template member}}
+ {typename T::A [x, y] = 0;} // expected-error {{cannot be declared with type 'typename T::A'}} expected-error {{type 'typename X::A<int>' (aka 'typename_specifier::X::A<int>') decomposes into 0}}
+ }
+ template void f<X>(); // expected-note {{instantiation of}}
+
+ template<typename T> void g(typename T::A = 0); // expected-note {{refers to class template member}}
+ void h() { g<X>(); } // expected-error {{no matching function}}
+}
diff --git a/test/Parser/declspec-recovery.c b/test/Parser/declspec-recovery.c
new file mode 100644
index 0000000000000..b256861b9f397
--- /dev/null
+++ b/test/Parser/declspec-recovery.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -verify %s
+
+__declspec(naked) void f(void) {} // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}}
+
+struct S {
+ __declspec(property(get=Getter, put=Setter)) int X; // expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes}}
+ int Y;
+};
diff --git a/test/Parser/declspec-supported.c b/test/Parser/declspec-supported.c
new file mode 100644
index 0000000000000..f9004893a4a25
--- /dev/null
+++ b/test/Parser/declspec-supported.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fms-extensions -verify %s
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fdeclspec -verify %s
+// expected-no-diagnostics
+
+__declspec(naked) void f(void) {}
+
+struct S {
+ __declspec(property(get=Getter, put=Setter)) int X;
+ int Y;
+};
diff --git a/test/Parser/eof.cpp b/test/Parser/eof.cpp
index 3c966c50e1db3..4a06587edea37 100644
--- a/test/Parser/eof.cpp
+++ b/test/Parser/eof.cpp
@@ -1,6 +1,6 @@
// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s
-// CHECK: error: expected member name or ';' after declaration specifiers
+// CHECK: error: expected '<' after 'template'
// CHECK: error: expected '}'
// CHECK: note: to match this '{'
// CHECK: error: expected ';' after class
diff --git a/test/Parser/objc-available.m b/test/Parser/objc-available.m
index d18ac1f13445d..a170721240ce8 100644
--- a/test/Parser/objc-available.m
+++ b/test/Parser/objc-available.m
@@ -20,3 +20,8 @@ void f() {
(void)@available(macos); // expected-error{{expected a version}}
(void)@available; // expected-error{{expected '('}}
}
+
+#if __has_builtin(__builtin_available)
+#error expected
+// expected-error@-1 {{expected}}
+#endif
diff --git a/test/Parser/objc-cxx-keyword-identifiers.mm b/test/Parser/objc-cxx-keyword-identifiers.mm
new file mode 100644
index 0000000000000..6791f0d3732a2
--- /dev/null
+++ b/test/Parser/objc-cxx-keyword-identifiers.mm
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-objc-root-class -Wno-incomplete-implementation -triple x86_64-apple-macosx10.10.0 -verify %s
+
+// rdar://20626062
+
+struct S {
+ int throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
+};
+
+@interface class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+@end
+
+@interface Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+@end
+
+@protocol P // ok
+@end
+
+@protocol new // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
+@end
+
+@protocol P2, delete; // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
+
+@class Foo, try; // expected-error {{expected identifier; 'try' is a keyword in Objective-C++}}
+
+@interface Foo
+
+@property (readwrite, nonatomic) int a, b, throw; // expected-error {{expected member name or ';' after declaration specifiers; 'throw' is a keyword in Objective-C++}}
+
+-foo:(int)class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
++foo:(int)constexpr; // expected-error {{expected identifier; 'constexpr' is a keyword in Objective-C++}}
+
+@end
+
+@interface Foo () <P, new> // expected-error {{expected identifier; 'new' is a keyword in Objective-C++}}
+@end
+
+@implementation Foo
+
+@synthesize a = _a; // ok
+@synthesize b = virtual; // expected-error {{expected identifier; 'virtual' is a keyword in Objective-C++}}
+
+@dynamic throw; // expected-error {{expected identifier; 'throw' is a keyword in Objective-C++}}
+
+-foo:(int)class { // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+}
+
+@end
+
+@implementation class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+@end
+
+@implementation Bar: class // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+@end
+
+@compatibility_alias C Foo; // ok
+@compatibility_alias const_cast Bar; // expected-error {{expected identifier; 'const_cast' is a keyword in Objective-C++}}
+@compatibility_alias C2 class; // expected-error {{expected identifier; 'class' is a keyword in Objective-C++}}
+
+void func() {
+ (void)@protocol(P); // ok
+ (void)@protocol(delete); // expected-error {{expected identifier; 'delete' is a keyword in Objective-C++}}
+}
diff --git a/test/Parser/opencl-atomics-cl20.cl b/test/Parser/opencl-atomics-cl20.cl
index 65fb9d9b42a84..ad67db0bab8a0 100644
--- a/test/Parser/opencl-atomics-cl20.cl
+++ b/test/Parser/opencl-atomics-cl20.cl
@@ -67,7 +67,7 @@ void atomic_ops_test() {
foo(&i);
// OpenCL v2.0 s6.13.11.8, arithemtic operations are not permitted on atomic types.
i++; // expected-error {{invalid argument type 'atomic_int' (aka '_Atomic(int)') to unary expression}}
- i = 1; // expected-error {{atomic variable can only be assigned to a compile time constant in the declaration statement in the program scope}}
+ i = 1; // expected-error {{atomic variable can be assigned to a variable only in global address space}}
i += 1; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'int')}}
i = i + i; // expected-error {{invalid operands to binary expression ('atomic_int' (aka '_Atomic(int)') and 'atomic_int')}}
}
diff --git a/test/Parser/pragma-fp.cpp b/test/Parser/pragma-fp.cpp
new file mode 100644
index 0000000000000..00547bfb546ad
--- /dev/null
+++ b/test/Parser/pragma-fp.cpp
@@ -0,0 +1,64 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+void test_0(int *List, int Length) {
+/* expected-error@+1 {{missing option; expected contract}} */
+#pragma clang fp
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+void test_1(int *List, int Length) {
+/* expected-error@+1 {{invalid option 'blah'; expected contract}} */
+#pragma clang fp blah
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_3(int *List, int Length) {
+/* expected-error@+1 {{expected '('}} */
+#pragma clang fp contract on
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_4(int *List, int Length) {
+/* expected-error@+1 {{unexpected argument 'while' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */
+#pragma clang fp contract(while)
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_5(int *List, int Length) {
+/* expected-error@+1 {{unexpected argument 'maybe' to '#pragma clang fp contract'; expected 'on', 'fast' or 'off'}} */
+#pragma clang fp contract(maybe)
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_6(int *List, int Length) {
+/* expected-error@+1 {{expected ')'}} */
+#pragma clang fp contract(fast
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_7(int *List, int Length) {
+/* expected-warning@+1 {{extra tokens at end of '#pragma clang fp' - ignored}} */
+#pragma clang fp contract(fast) *
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+void test_8(int *List, int Length) {
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+/* expected-error@+1 {{'#pragma clang fp' can only appear at file scope or at the start of a compound statement}} */
+#pragma clang fp contract(fast)
+ }
+}
diff --git a/test/Parser/vector-cast-define.cl b/test/Parser/vector-cast-define.cl
new file mode 100644
index 0000000000000..ec4eba7a78488
--- /dev/null
+++ b/test/Parser/vector-cast-define.cl
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// expected-no-diagnostics
+
+typedef int int3 __attribute__((ext_vector_type(3)));
+
+void test()
+{
+ int index = (int3)(1, 2, 3).x * (int3)(3, 2, 1).y;
+}
+
diff --git a/test/Parser/vsx.c b/test/Parser/vsx.c
index ead09814c8c12..32bc934a7eb6e 100644
--- a/test/Parser/vsx.c
+++ b/test/Parser/vsx.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s
-// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -faltivec -target-feature +vsx -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -target-feature +altivec -target-feature +vsx -fsyntax-only -verify %s
// Legitimate for VSX.
__vector double vv_d1;