diff options
Diffstat (limited to 'test/Parser/cxx-decl.cpp')
-rw-r--r-- | test/Parser/cxx-decl.cpp | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index 290b947..41d305b 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic %s +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic -fcxx-exceptions -fexceptions %s const char const *x10; // expected-warning {{duplicate 'const' declaration specifier}} @@ -124,6 +124,69 @@ void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}} // PR4111 void f(sqrgl); // expected-error {{unknown type name 'sqrgl'}} +// PR9903 +struct S { + typedef void a() { }; // expected-error {{function definition declared 'typedef'}} + typedef void c() try { } catch(...) { } // expected-error {{function definition declared 'typedef'}} + int n, m; + typedef S() : n(1), m(2) { } // expected-error {{function definition declared 'typedef'}} +}; + + +namespace TestIsValidAfterTypeSpecifier { +struct s {} v; + +namespace a { +struct s operator++(struct s a) +{ return a; } +} + +namespace b { +// The newline after s should make no difference. +struct s +operator++(struct s a) +{ return a; } +} + +struct X { + struct s + friend f(); + struct s + virtual f(); +}; + +struct s +&r0 = v; +struct s +bitand r2 = v; + +} + +struct DIE { + void foo() {} +}; + +void test (DIE die, DIE *Die, DIE INT, DIE *FLOAT) { + DIE.foo(); // expected-error {{cannot use dot operator on a type}} + die.foo(); + + DIE->foo(); // expected-error {{cannot use arrow operator on a type}} + Die->foo(); + + int.foo(); // expected-error {{cannot use dot operator on a type}} + INT.foo(); + + float->foo(); // expected-error {{cannot use arrow operator on a type}} + FLOAT->foo(); +} + +namespace PR15017 { + template<typename T = struct X { int i; }> struct S {}; // expected-error {{'PR15017::X' can not be defined in a type specifier}} +} + +// Ensure we produce at least some diagnostic for attributes in C++98. +[[]] struct S; // expected-error 2{{}} + // PR8380 extern "" // expected-error {{unknown linkage language}} test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \ |