summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/MicrosoftExtensions.cpp56
-rw-r--r--test/Parser/block-block-storageclass.c1
-rw-r--r--test/Parser/block-pointer-decl.c1
-rw-r--r--test/Parser/builtin_classify_type.c2
-rw-r--r--test/Parser/check-objc2-syntax-1.m1
-rw-r--r--test/Parser/colon-colon-parentheses.cpp22
-rw-r--r--test/Parser/compound_literal.c1
-rw-r--r--test/Parser/cxx-ambig-decl-expr.cpp3
-rw-r--r--test/Parser/cxx-attributes.cpp1
-rw-r--r--test/Parser/cxx-casting.cpp12
-rw-r--r--test/Parser/cxx-class.cpp14
-rw-r--r--test/Parser/cxx-decl.cpp5
-rw-r--r--test/Parser/cxx-extern-c-array.cpp1
-rw-r--r--test/Parser/cxx-stmt.cpp8
-rw-r--r--test/Parser/cxx-template-argument.cpp17
-rw-r--r--test/Parser/cxx0x-attributes.cpp26
-rw-r--r--test/Parser/cxx0x-condition.cpp9
-rw-r--r--test/Parser/cxx0x-decl.cpp14
-rw-r--r--test/Parser/cxx0x-lambda-expressions.cpp3
-rw-r--r--test/Parser/cxx0x-override-control-keywords.cpp1
-rw-r--r--test/Parser/cxx11-brace-initializers.cpp16
-rw-r--r--test/Parser/cxx11-stmt-attributes.cpp77
-rw-r--r--test/Parser/cxx11-user-defined-literals.cpp3
-rw-r--r--test/Parser/empty-translation-unit.c2
-rw-r--r--test/Parser/encode.m1
-rw-r--r--test/Parser/enhanced-proto-1.m1
-rw-r--r--test/Parser/if-scope-c90.c1
-rw-r--r--test/Parser/knr_parameter_attributes.c1
-rw-r--r--test/Parser/ms-inline-asm.c8
-rw-r--r--test/Parser/namelookup-bug-1.c1
-rw-r--r--test/Parser/namelookup-bug-2.c1
-rw-r--r--test/Parser/namespaces.cpp4
-rw-r--r--test/Parser/objcxx11-attributes.mm18
-rw-r--r--test/Parser/opencl-kernel.cl1
-rw-r--r--test/Parser/parmvardecl_conversion.c1
-rw-r--r--test/Parser/pragma-fp-contract.c12
-rw-r--r--test/Parser/pragma-options.cpp6
-rw-r--r--test/Parser/recovery.cpp7
-rw-r--r--test/Parser/recursion-limits.cpp1
-rw-r--r--test/Parser/selector-1.m1
-rw-r--r--test/Parser/statements.c15
-rw-r--r--test/Parser/top-level-semi-cxx0x.cpp1
-rw-r--r--test/Parser/types.c1
43 files changed, 296 insertions, 82 deletions
diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp
index 6219e29..fd38dca 100644
--- a/test/Parser/MicrosoftExtensions.cpp
+++ b/test/Parser/MicrosoftExtensions.cpp
@@ -174,13 +174,21 @@ void redundant_typename() {
__interface MicrosoftInterface;
__interface MicrosoftInterface {
- virtual void foo1() = 0;
+ void foo1() = 0;
virtual void foo2() = 0;
};
+__interface MicrosoftDerivedInterface : public MicrosoftInterface {
+ void foo1();
+ void foo2() override;
+ void foo3();
+};
+
void interface_test() {
MicrosoftInterface* a;
a->foo1();
+ MicrosoftDerivedInterface* b;
+ b->foo2();
}
__int64 x7 = __int64(0);
@@ -230,29 +238,29 @@ __if_not_exists(IF_EXISTS::Type_not) {
int __if_exists_init_list() {
- int array1[] = {
- 0,
- __if_exists(IF_EXISTS::Type) {2, }
- 3
- };
-
- int array2[] = {
- 0,
- __if_exists(IF_EXISTS::Type_not) { this wont compile }
- 3
- };
-
- int array3[] = {
- 0,
- __if_not_exists(IF_EXISTS::Type_not) {2, }
- 3
- };
-
- int array4[] = {
- 0,
- __if_not_exists(IF_EXISTS::Type) { this wont compile }
- 3
- };
+ int array1[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type) {2, }
+ 3
+ };
+
+ int array2[] = {
+ 0,
+ __if_exists(IF_EXISTS::Type_not) { this wont compile }
+ 3
+ };
+
+ int array3[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type_not) {2, }
+ 3
+ };
+
+ int array4[] = {
+ 0,
+ __if_not_exists(IF_EXISTS::Type) { this wont compile }
+ 3
+ };
}
diff --git a/test/Parser/block-block-storageclass.c b/test/Parser/block-block-storageclass.c
index 97ba113..53cd997 100644
--- a/test/Parser/block-block-storageclass.c
+++ b/test/Parser/block-block-storageclass.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
+// expected-no-diagnostics
int printf(const char *, ...);
void _Block_byref_release(void*src){}
diff --git a/test/Parser/block-pointer-decl.c b/test/Parser/block-pointer-decl.c
index a8cc258..d88daf3 100644
--- a/test/Parser/block-pointer-decl.c
+++ b/test/Parser/block-pointer-decl.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+// expected-no-diagnostics
int printf(char const *, ...);
diff --git a/test/Parser/builtin_classify_type.c b/test/Parser/builtin_classify_type.c
index a7c0855..ff483b2 100644
--- a/test/Parser/builtin_classify_type.c
+++ b/test/Parser/builtin_classify_type.c
@@ -10,7 +10,7 @@ int main() {
static int ary[__builtin_classify_type(a)];
static int ary2[(__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
- static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}}
+ static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{builtin functions must be directly called}}
int result;
diff --git a/test/Parser/check-objc2-syntax-1.m b/test/Parser/check-objc2-syntax-1.m
index 3cdf2b0..9aff963 100644
--- a/test/Parser/check-objc2-syntax-1.m
+++ b/test/Parser/check-objc2-syntax-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface Subclass
+ (int)magicNumber;
diff --git a/test/Parser/colon-colon-parentheses.cpp b/test/Parser/colon-colon-parentheses.cpp
new file mode 100644
index 0000000..55948fd
--- /dev/null
+++ b/test/Parser/colon-colon-parentheses.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: cp %s %t
+// RUN: not %clang_cc1 -x c++ -fixit %t
+// RUN: %clang_cc1 -x c++ %t
+
+struct S { static int a,b,c;};
+int S::(a); // expected-error{{unexpected parenthesis after '::'}}
+int S::(b; // expected-error{{unexpected parenthesis after '::'}}
+int S::c;
+int S::(*d); // expected-error{{unexpected parenthesis after '::'}}
+int S::(*e; // expected-error{{unexpected parenthesis after '::'}}
+int S::*f;
+int g = S::(a); // expected-error{{unexpected parenthesis after '::'}}
+int h = S::(b; // expected-error{{unexpected parenthesis after '::'}}
+int i = S::c;
+
+void foo() {
+ int a;
+ a = ::(g); // expected-error{{unexpected parenthesis after '::'}}
+ a = ::(h; // expected-error{{unexpected parenthesis after '::'}}
+ a = ::i;
+}
diff --git a/test/Parser/compound_literal.c b/test/Parser/compound_literal.c
index 4f3609d..9a0e4a6 100644
--- a/test/Parser/compound_literal.c
+++ b/test/Parser/compound_literal.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
int main() {
char *s;
s = (char []){"whatever"};
diff --git a/test/Parser/cxx-ambig-decl-expr.cpp b/test/Parser/cxx-ambig-decl-expr.cpp
index b5ff728..feb185f 100644
--- a/test/Parser/cxx-ambig-decl-expr.cpp
+++ b/test/Parser/cxx-ambig-decl-expr.cpp
@@ -7,4 +7,7 @@ struct X {
void f() {
void (*ptr)(int, int) = &X::f<int, int>;
+
+ unknown *p = 0; // expected-error {{unknown type name 'unknown'}}
+ unknown * p + 0; // expected-error {{undeclared identifier 'unknown'}}
}
diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp
index 8603b30..5ea0ce2 100644
--- a/test/Parser/cxx-attributes.cpp
+++ b/test/Parser/cxx-attributes.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
class c {
virtual void f1(const char* a, ...)
diff --git a/test/Parser/cxx-casting.cpp b/test/Parser/cxx-casting.cpp
index 42ad12e..01980d3 100644
--- a/test/Parser/cxx-casting.cpp
+++ b/test/Parser/cxx-casting.cpp
@@ -58,9 +58,9 @@ void test2(char x, struct B * b) {
expected-error {{expected ']'}}
#define LC <:
#define C :
- test1::A LC:B> c; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ test1::A LC:B> c; // expected-error {{class template test1::A requires template arguments}} expected-error 2{{}}
(void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
- test1::A<:C B> d; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}}
+ test1::A<:C B> d; // expected-error {{class template test1::A requires template arguments}} expected-error 2{{}}
(void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}}
#define LCC <::
@@ -85,8 +85,10 @@ void test3() {
E< ::F>();
// Make sure that parser doesn't expand '[:' to '< ::'
- ::D[:F> A5; // expected-error {{cannot refer to class template 'D' without a template argument list}} \
+ ::D[:F> A5; // expected-error {{class template ::D requires template arguments}} \
// expected-error {{expected expression}} \
- // expected-error {{expected ']'}} \
- // expected-note {{to match this '['}}
+ // expected-error {{expected unqualified-id}}
}
+
+// PR13619. Must be at end of file.
+int n = reinterpret_cast // expected-error {{expected '<'}} expected-error {{expected ';'}}
diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp
index feccba8..8ed5882 100644
--- a/test/Parser/cxx-class.cpp
+++ b/test/Parser/cxx-class.cpp
@@ -88,6 +88,20 @@ namespace ctor_error {
// expected-error{{unknown type name 'UnknownType'}}
}
+// PR13775: Don't assert here.
+namespace PR13775 {
+ class bar
+ {
+ public:
+ void foo ();
+ void baz ();
+ };
+ void bar::foo ()
+ {
+ baz x(); // expected-error 3{{}}
+ }
+}
+
// PR11109 must appear at the end of the source file
class pr11109r3 { // expected-note{{to match this '{'}}
public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 951cd3d..290b947 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic %s
+const char const *x10; // expected-warning {{duplicate 'const' declaration specifier}}
+
int x(*g); // expected-error {{use of undeclared identifier 'g'}}
struct Type {
@@ -119,6 +121,9 @@ void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
;
+// PR4111
+void f(sqrgl); // expected-error {{unknown type name 'sqrgl'}}
+
// PR8380
extern "" // expected-error {{unknown linkage language}}
test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \
diff --git a/test/Parser/cxx-extern-c-array.cpp b/test/Parser/cxx-extern-c-array.cpp
index 14912fd..11092ad 100644
--- a/test/Parser/cxx-extern-c-array.cpp
+++ b/test/Parser/cxx-extern-c-array.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
extern "C" int myarray[];
int myarray[12] = {0};
diff --git a/test/Parser/cxx-stmt.cpp b/test/Parser/cxx-stmt.cpp
index 7677ca8..c2fa0a4 100644
--- a/test/Parser/cxx-stmt.cpp
+++ b/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);
+}
diff --git a/test/Parser/cxx-template-argument.cpp b/test/Parser/cxx-template-argument.cpp
index 5479961..afe318d 100644
--- a/test/Parser/cxx-template-argument.cpp
+++ b/test/Parser/cxx-template-argument.cpp
@@ -25,3 +25,20 @@ namespace greatergreater {
(void)(&t<S<int>>==p); // expected-error {{use '> >'}} expected-error {{use '> ='}}
}
}
+
+namespace PR5925 {
+ template <typename x>
+ class foo { // expected-note {{here}}
+ };
+ void bar(foo *X) { // expected-error {{requires template arguments}}
+ }
+}
+
+namespace PR13210 {
+ template <class T>
+ class C {}; // expected-note {{here}}
+
+ void f() {
+ new C(); // expected-error {{requires template arguments}}
+ }
+}
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index a0b8467..58e42bf 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -44,10 +44,15 @@ int & [[]] ref_attr = after_attr;
int && [[]] rref_attr = 0;
int array_attr [1] [[]];
alignas(8) int aligned_attr;
-[[test::valid(for 42 [very] **** '+' symbols went on a trip and had a "good"_time; the end.)]]
- int garbage_attr;
-[[,,,static, class, namespace,, inline, constexpr, mutable,, bi\
-tand, bitor::compl(!.*_ Cx.!U^*R),,,]] int more_garbage_attr;
+[[test::valid(for 42 [very] **** '+' symbols went on a trip and had a "good"_time; the end.)]] int garbage_attr; // expected-warning {{unknown attribute 'valid' ignored}}
+[[,,,static, class, namespace,, inline, constexpr, mutable,, bitand, bitor::compl(!.*_ Cx.!U^*R),,,]] int more_garbage_attr; // expected-warning {{unknown attribute 'static' ignored}} \
+ // expected-warning {{unknown attribute 'class' ignored}} \
+ // expected-warning {{unknown attribute 'namespace' ignored}} \
+ // expected-warning {{unknown attribute 'inline' ignored}} \
+ // expected-warning {{unknown attribute 'constexpr' ignored}} \
+ // expected-warning {{unknown attribute 'mutable' ignored}} \
+ // expected-warning {{unknown attribute 'bitand' ignored}} \
+ // expected-warning {{unknown attribute 'compl' ignored}}
[[u8"invalid!"]] int invalid_string_attr; // expected-error {{expected ']'}}
void fn_attr () [[]];
void noexcept_fn_attr () noexcept [[]];
@@ -212,3 +217,16 @@ enum class __attribute__((visibility("hidden"))) SecretKeepers {
one, /* rest are deprecated */ two, three
};
enum class [[]] EvenMoreSecrets {};
+
+namespace arguments {
+ // FIXME: remove the sema warnings after migrating existing gnu attributes to c++11 syntax.
+ void f(const char*, ...) [[gnu::format(printf, 1, 2)]]; // expected-warning {{unknown attribute 'format' ignored}}
+ void g() [[unknown::foo(currently arguments of attributes from unknown namespace other than 'gnu' namespace are ignored... blah...)]]; // expected-warning {{unknown attribute 'foo' ignored}}
+}
+
+// forbid attributes on decl specifiers
+unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
+ expected-error {{an attribute list cannot appear here}}
+typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
+ expected-error {{an attribute list cannot appear here}}
+int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-warning 2{{attribute 'carries_dependency' ignored, because it is not attached to a declaration}}
diff --git a/test/Parser/cxx0x-condition.cpp b/test/Parser/cxx0x-condition.cpp
index e45cd86..8b64bcf 100644
--- a/test/Parser/cxx0x-condition.cpp
+++ b/test/Parser/cxx0x-condition.cpp
@@ -27,10 +27,11 @@ void f() {
if (S b(n) = 0) {} // expected-error {{a function type is not allowed here}}
if (S b(n) == 0) {} // expected-error {{a function type is not allowed here}} expected-error {{did you mean '='?}}
- if (S{a}) {} // ok
- if (S a{a}) {} // ok
- if (S a = {a}) {} // ok
- if (S a == {a}) {} // expected-error {{did you mean '='?}}
+ S s(a);
+ if (S{s}) {} // ok
+ if (S a{s}) {} // ok
+ if (S a = {s}) {} // ok
+ if (S a == {s}) {} // expected-error {{did you mean '='?}}
if (S(b){a}) {} // ok
if (S(b) = {a}) {} // ok
diff --git a/test/Parser/cxx0x-decl.cpp b/test/Parser/cxx0x-decl.cpp
index a6fc49c..3af73f9 100644
--- a/test/Parser/cxx0x-decl.cpp
+++ b/test/Parser/cxx0x-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic %s
+// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors %s
// Make sure we know these are legitimate commas and not typos for ';'.
namespace Commas {
@@ -23,8 +23,14 @@ class ExtraSemiAfterMemFn {
void f() = delete // expected-error {{expected ';' after delete}}
void g() = delete; // ok
void h() = delete;; // ok
- void i() = delete;;; // expected-warning {{extra ';' after member function definition}}
+ void i() = delete;;; // expected-error {{extra ';' after member function definition}}
};
-int *const const p = 0; // ok
-const const int *q = 0; // expected-warning {{duplicate 'const' declaration specifier}}
+int *const const p = 0; // expected-error {{duplicate 'const' declaration specifier}}
+const const int *q = 0; // expected-error {{duplicate 'const' declaration specifier}}
+
+struct MultiCV {
+ void f() const const; // expected-error {{duplicate 'const' declaration specifier}}
+};
+
+static_assert(something, ""); // expected-error {{undeclared identifier}}
diff --git a/test/Parser/cxx0x-lambda-expressions.cpp b/test/Parser/cxx0x-lambda-expressions.cpp
index 7e9d475..642c69a 100644
--- a/test/Parser/cxx0x-lambda-expressions.cpp
+++ b/test/Parser/cxx0x-lambda-expressions.cpp
@@ -26,6 +26,7 @@ class C {
[] -> int { return 0; }; // expected-error{{lambda requires '()' before return type}}
[] mutable -> int { return 0; }; // expected-error{{lambda requires '()' before 'mutable'}}
+ [](int) -> {}; // PR13652 expected-error {{expected a type}}
return 1;
}
@@ -33,7 +34,7 @@ class C {
typedef int T;
const int b = 0;
const int c = 1;
- int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from 'C::<lambda}}
+ int a1[1] = {[b] (T()) {}}; // expected-error{{no viable conversion from '<lambda}}
int a2[1] = {[b] = 1 };
int a3[1] = {[b,c] = 1 }; // expected-error{{expected body of lambda expression}}
int a4[1] = {[&b] = 1 }; // expected-error{{integral constant expression must have integral or unscoped enumeration type, not 'const int *'}}
diff --git a/test/Parser/cxx0x-override-control-keywords.cpp b/test/Parser/cxx0x-override-control-keywords.cpp
index 444862a..be79db3 100644
--- a/test/Parser/cxx0x-override-control-keywords.cpp
+++ b/test/Parser/cxx0x-override-control-keywords.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// expected-no-diagnostics
struct Base {
virtual void override();
diff --git a/test/Parser/cxx11-brace-initializers.cpp b/test/Parser/cxx11-brace-initializers.cpp
new file mode 100644
index 0000000..a210205
--- /dev/null
+++ b/test/Parser/cxx11-brace-initializers.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// expected-no-diagnostics
+
+struct S {
+ S(int, int) {}
+};
+
+void f(int, S const&, int) {}
+
+void test1()
+{
+ S X1{1, 1,};
+ S X2 = {1, 1,};
+
+ f(0, {1, 1}, 0);
+}
diff --git a/test/Parser/cxx11-stmt-attributes.cpp b/test/Parser/cxx11-stmt-attributes.cpp
index fab5621..f26db79 100644
--- a/test/Parser/cxx11-stmt-attributes.cpp
+++ b/test/Parser/cxx11-stmt-attributes.cpp
@@ -2,53 +2,78 @@
void foo(int i) {
- [[unknown_attribute]] ;
- [[unknown_attribute]] { }
- [[unknown_attribute]] if (0) { }
- [[unknown_attribute]] for (;;);
- [[unknown_attribute]] do {
- [[unknown_attribute]] continue;
+ [[unknown_attribute]] ; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] if (0) { } // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] for (;;); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] do { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] continue; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
} while (0);
- [[unknown_attribute]] while (0);
+ [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
- [[unknown_attribute]] switch (i) {
- [[unknown_attribute]] case 0:
- [[unknown_attribute]] default:
- [[unknown_attribute]] break;
+ [[unknown_attribute]] switch (i) { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] case 0: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] default: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] break; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
}
- [[unknown_attribute]] goto here;
- [[unknown_attribute]] here:
+ [[unknown_attribute]] goto here; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+ [[unknown_attribute]] here: // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
- [[unknown_attribute]] try {
+ [[unknown_attribute]] try { // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
} catch (...) {
}
- [[unknown_attribute]] return;
-
+ [[unknown_attribute]] return; // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+
alignas(8) ; // expected-warning {{attribute aligned cannot be specified on a statement}}
[[noreturn]] { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
[[noreturn]] if (0) { } // expected-warning {{attribute noreturn cannot be specified on a statement}}
[[noreturn]] for (;;); // expected-warning {{attribute noreturn cannot be specified on a statement}}
[[noreturn]] do { // expected-warning {{attribute noreturn cannot be specified on a statement}}
- [[unavailable]] continue; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[unavailable]] continue; // expected-warning {{unknown attribute 'unavailable' ignored}}
+ } while (0);
+ [[unknown_attributqqq]] while (0); // expected-warning {{unknown attribute 'unknown_attributqqq' ignored}}
+ // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
+
+ [[unknown_attribute]] while (0); // expected-warning {{unknown attribute 'unknown_attribute' ignored}}
+
+ [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' ignored}}
+ [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}}
+ [[visibility]] default: // expected-warning {{unknown attribute 'visibility' ignored}}
+ [[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ }
+
+ [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' ignored}}
+ [[noinline]] there: // expected-warning {{unknown attribute 'noinline' ignored}}
+
+ [[lock_returned]] try { // expected-warning {{unknown attribute 'lock_returned' ignored}}
+ } catch (...) {
+ }
+
+ [[weakref]] return; // expected-warning {{unknown attribute 'weakref' ignored}}
+
+ [[carries_dependency]] ; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] if (0) { } // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] for (;;); // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] do { // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] continue; // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}}
} while (0);
- [[unknown_attributqqq]] while (0); // TODO: remove 'qqq' part and enjoy 'empty loop body' warning here (DiagnoseEmptyLoopBody)
- [[unknown_attribute]] while (0); // no warning here yet, just an unknown attribute
+ [[carries_dependency]] while (0); // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
- [[unused]] switch (i) { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
- [[uuid]] case 0: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
- [[visibility]] default: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[carries_dependency]] switch (i) { // expected-warning {{attribute carries_dependency cannot be specified on a statement}} ignored}}
+ [[carries_dependency]] case 0: // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
+ [[carries_dependency]] default: // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
[[carries_dependency]] break; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
}
- [[fastcall]] goto there; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
- [[noinline]] there: // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[carries_dependency]] goto here; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
- [[lock_returned]] try { // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[carries_dependency]] try { // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
} catch (...) {
}
- [[weakref]] return; // TODO: only noreturn, alignas and carries_dependency are parsed in C++ 11 syntax at the moment, hence no warning here
+ [[carries_dependency]] return; // expected-warning {{attribute carries_dependency cannot be specified on a statement}}
}
diff --git a/test/Parser/cxx11-user-defined-literals.cpp b/test/Parser/cxx11-user-defined-literals.cpp
index 49fea01..613c0b9 100644
--- a/test/Parser/cxx11-user-defined-literals.cpp
+++ b/test/Parser/cxx11-user-defined-literals.cpp
@@ -102,9 +102,10 @@ void operator R"xyzzy()xyzzy" _foo(long double); // ok
void operator"" "" R"()" "" _foo(const char *); // ok
+void operator ""_no_space(const char *); // ok
+
// Ensure we diagnose the bad cases.
void operator "\0" _non_empty(const char *); // expected-error {{must be '""'}}
-void operator ""_no_space(const char *); // expected-error {{C++11 requires a space}}
void operator L"" _not_char(const char *); // expected-error {{cannot have an encoding prefix}}
void operator "" ""
U"" // expected-error {{cannot have an encoding prefix}}
diff --git a/test/Parser/empty-translation-unit.c b/test/Parser/empty-translation-unit.c
index 0dbf37e..04e57f6 100644
--- a/test/Parser/empty-translation-unit.c
+++ b/test/Parser/empty-translation-unit.c
@@ -7,4 +7,4 @@
#define A_MACRO_IS_NOT_GOOD_ENOUGH 1
// In C we should get this warning, but in C++ we shouldn't.
-// expected-warning{{ISO C requires a translation unit to contain at least one declaration.}}
+// expected-warning{{ISO C requires a translation unit to contain at least one declaration}}
diff --git a/test/Parser/encode.m b/test/Parser/encode.m
index 7b8022e..056cee1 100644
--- a/test/Parser/encode.m
+++ b/test/Parser/encode.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
int main(void) {
const char ch = @encode(char *)[0];
diff --git a/test/Parser/enhanced-proto-1.m b/test/Parser/enhanced-proto-1.m
index fa6e413..bad5c7c 100644
--- a/test/Parser/enhanced-proto-1.m
+++ b/test/Parser/enhanced-proto-1.m
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol MyProto1
@optional
diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c
index c368fab..61119ea 100644
--- a/test/Parser/if-scope-c90.c
+++ b/test/Parser/if-scope-c90.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c90 %s
+// expected-no-diagnostics
int f (int z)
{
diff --git a/test/Parser/knr_parameter_attributes.c b/test/Parser/knr_parameter_attributes.c
index fb975cb..b11a75e 100644
--- a/test/Parser/knr_parameter_attributes.c
+++ b/test/Parser/knr_parameter_attributes.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -W -Wall -Werror -verify %s
+// expected-no-diagnostics
int f(int i __attribute__((__unused__)))
{
diff --git a/test/Parser/ms-inline-asm.c b/test/Parser/ms-inline-asm.c
index 5326ce4..0e8b317 100644
--- a/test/Parser/ms-inline-asm.c
+++ b/test/Parser/ms-inline-asm.c
@@ -6,7 +6,7 @@
void t1(void) { M } // expected-warning {{MS-style inline assembly is not supported}}
void t2(void) { __asm int 0x2c } // expected-warning {{MS-style inline assembly is not supported}}
void t3(void) { __asm M2 0x2c } // expected-warning {{MS-style inline assembly is not supported}}
-void* t4(void) { __asm mov eax, fs:[0x10] } // expected-warning {{MS-style inline assembly is not supported}}
+void t4(void) { __asm mov eax, fs:[0x10] } // expected-warning {{MS-style inline assembly is not supported}}
void t5() {
__asm { // expected-warning {{MS-style inline assembly is not supported}}
int 0x2c ; } asm comments are fun! }{
@@ -20,7 +20,7 @@ int t6() {
__asm int 4 // expected-warning {{MS-style inline assembly is not supported}}
return 10;
}
-int t7() {
+void t7() {
__asm { // expected-warning {{MS-style inline assembly is not supported}}
push ebx
mov ebx, 0x07
@@ -34,5 +34,5 @@ void t9() {
__asm nop __asm nop ; __asm nop // expected-warning {{MS-style inline assembly is not supported}}
}
int t_fail() { // expected-note {{to match this}}
- __asm
- __asm { // expected-error 3 {{expected}} expected-note {{to match this}}
+ __asm // expected-warning {{MS-style inline assembly is not supported}}
+ __asm { // expected-warning {{MS-style inline assembly is not supported}} expected-error 3 {{expected}} expected-note {{to match this}}
diff --git a/test/Parser/namelookup-bug-1.c b/test/Parser/namelookup-bug-1.c
index 8667a71..31d17a9 100644
--- a/test/Parser/namelookup-bug-1.c
+++ b/test/Parser/namelookup-bug-1.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify %s
+// expected-no-diagnostics
typedef int Object;
diff --git a/test/Parser/namelookup-bug-2.c b/test/Parser/namelookup-bug-2.c
index 84850ff..4598da0 100644
--- a/test/Parser/namelookup-bug-2.c
+++ b/test/Parser/namelookup-bug-2.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify %s
+// expected-no-diagnostics
typedef int Object;
diff --git a/test/Parser/namespaces.cpp b/test/Parser/namespaces.cpp
index b8c7819..6491cfd 100644
--- a/test/Parser/namespaces.cpp
+++ b/test/Parser/namespaces.cpp
@@ -6,3 +6,7 @@ namespace g { enum { o = 0 }; }
void foo() {
namespace a { typedef g::o o; } // expected-error{{namespaces can only be defined in global or namespace scope}}
}
+
+// PR14085
+namespace PR14085 {}
+namespace = PR14085; // expected-error {{expected identifier}}
diff --git a/test/Parser/objcxx11-attributes.mm b/test/Parser/objcxx11-attributes.mm
index 1b9bf66..ad54208 100644
--- a/test/Parser/objcxx11-attributes.mm
+++ b/test/Parser/objcxx11-attributes.mm
@@ -31,9 +31,13 @@ void f(X *noreturn) {
// An attribute is OK.
[[]];
- [[int(), noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}}
- [[class, test(foo 'x' bar),,,]];
- [[bitand, noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[int(), noreturn]]; // expected-warning {{unknown attribute 'int' ignored}} \
+ // expected-warning {{attribute noreturn cannot be specified on a statement}}
+ [[class, test(foo 'x' bar),,,]]; // expected-warning {{unknown attribute 'test' ignored}}\
+ // expected-warning {{unknown attribute 'class' ignored}}
+
+ [[bitand, noreturn]]; // expected-warning {{attribute noreturn cannot be specified on a statement}} \
+ expected-warning {{unknown attribute 'bitand' ignored}}
// FIXME: Suppress vexing parse warning
[[noreturn]]int(e)(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
@@ -52,7 +56,11 @@ void f(X *noreturn) {
}
template<typename...Ts> void f(Ts ...x) {
- [[test::foo(bar, baz)...]];
- [[used(x)...]];
+ [[test::foo(bar, baz)...]]; // expected-error {{attribute 'foo' cannot be used as an attribute pack}} \
+ // expected-warning {{unknown attribute 'foo' ignored}}
+
+ [[used(x)...]]; // expected-error {{attribute 'used' cannot be used as an attribute pack}} \
+ // expected-warning {{unknown attribute 'used' ignored}}
+
[[x...] { return [ X alloc ]; }() init];
}
diff --git a/test/Parser/opencl-kernel.cl b/test/Parser/opencl-kernel.cl
index 3abb62b..01c7ed6 100644
--- a/test/Parser/opencl-kernel.cl
+++ b/test/Parser/opencl-kernel.cl
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// expected-no-diagnostics
__kernel void test()
{
diff --git a/test/Parser/parmvardecl_conversion.c b/test/Parser/parmvardecl_conversion.c
index 9fa8a68..f6afd12 100644
--- a/test/Parser/parmvardecl_conversion.c
+++ b/test/Parser/parmvardecl_conversion.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
void f (int p[]) { p++; }
diff --git a/test/Parser/pragma-fp-contract.c b/test/Parser/pragma-fp-contract.c
new file mode 100644
index 0000000..568c0a0
--- /dev/null
+++ b/test/Parser/pragma-fp-contract.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1(void) {
+ int x = 0;
+/* expected-error@+1 {{'#pragma fp_contract' should only appear at file scope or at the start of a compound expression}} */
+#pragma STDC FP_CONTRACT ON
+}
+
+void f2(void) {
+ #pragma STDC FP_CONTRACT OFF
+ #pragma STDC FP_CONTRACT ON
+}
diff --git a/test/Parser/pragma-options.cpp b/test/Parser/pragma-options.cpp
new file mode 100644
index 0000000..84cd38d
--- /dev/null
+++ b/test/Parser/pragma-options.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class C {
+#pragma options align=natural
+};
diff --git a/test/Parser/recovery.cpp b/test/Parser/recovery.cpp
index ff68758..732b9ae 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 %s
8gi///===--- recovery.cpp ---===// // expected-error {{unqualified-id}}
namespace Std { // expected-note {{here}}
@@ -23,12 +23,15 @@ void g() {
struct S {
int a, b, c;
S();
+ int x // expected-error {{expected ';'}}
+ friend void f()
};
8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}}
return;
}
int k;
-int l = k;
+int l = k // expected-error {{expected ';'}}
+constexpr int foo();
5int m = { l }, n = m; // expected-error {{unqualified-id}}
diff --git a/test/Parser/recursion-limits.cpp b/test/Parser/recursion-limits.cpp
index ea25dea..bb7354f 100644
--- a/test/Parser/recursion-limits.cpp
+++ b/test/Parser/recursion-limits.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only %s -verify
+// expected-no-diagnostics
class outer {
class inner1 { inner1(); };
class inner2 { inner2(); };
diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m
index 5ba2da9..3e2a86d 100644
--- a/test/Parser/selector-1.m
+++ b/test/Parser/selector-1.m
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://8366474
int main() {
diff --git a/test/Parser/statements.c b/test/Parser/statements.c
index 3a123d6..8215f4c 100644
--- a/test/Parser/statements.c
+++ b/test/Parser/statements.c
@@ -62,3 +62,18 @@ void test8() {
// Should not skip '}' and produce a "expected '}'" error.
undecl // expected-error {{use of undeclared identifier 'undecl'}}
}
+
+int test9() {
+ int T[] = {1, 2, };
+
+ int X;
+ X = 0, // expected-error {{expected ';' after expression}}
+ {
+ }
+
+ X = 0, // expected-error {{expected ';' after expression}}
+ if (0)
+ ;
+
+ return 4, // expected-error {{expected ';' after return statement}}
+}
diff --git a/test/Parser/top-level-semi-cxx0x.cpp b/test/Parser/top-level-semi-cxx0x.cpp
index be342a2..472686e 100644
--- a/test/Parser/top-level-semi-cxx0x.cpp
+++ b/test/Parser/top-level-semi-cxx0x.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -pedantic -std=c++11 -verify %s
+// expected-no-diagnostics
void foo();
diff --git a/test/Parser/types.c b/test/Parser/types.c
index 53b9dd5..db8c083 100644
--- a/test/Parser/types.c
+++ b/test/Parser/types.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
+// expected-no-diagnostics
// Test the X can be overloaded inside the struct.
typedef int X;
OpenPOWER on IntegriCloud