diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/PR16677.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaCXX/invalid-template-params.cpp | 23 |
2 files changed, 25 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/PR16677.cpp b/clang/test/SemaCXX/PR16677.cpp index 7140ac79f08..efa4faaacd6 100644 --- a/clang/test/SemaCXX/PR16677.cpp +++ b/clang/test/SemaCXX/PR16677.cpp @@ -10,7 +10,6 @@ class Base { }; template<class T, // Should be angle bracket instead of comma class Derived : public Base<T> { // expected-error{{'Derived' cannot be defined in a type specifier}} Class_With_Destructor member; -}; // expected-error{{a non-type template parameter cannot have type 'class Derived'}} - // expected-error@-1{{expected ',' or '>' in template-parameter-list}} - // expected-warning@-2{{declaration does not declare anything}} +}; // expected-error{{expected ',' or '>' in template-parameter-list}} + // expected-warning@-1{{declaration does not declare anything}} diff --git a/clang/test/SemaCXX/invalid-template-params.cpp b/clang/test/SemaCXX/invalid-template-params.cpp new file mode 100644 index 00000000000..0c463fe13d5 --- /dev/null +++ b/clang/test/SemaCXX/invalid-template-params.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +template<class> class Foo { + template<class UBar // expected-error {{expected ';' after class}} + // expected-note@-1 {{'UBar' declared here}} + void foo1(); // expected-error {{a non-type template parameter cannot have type 'class UBar'}} + // expected-error@-1 {{expected ',' or '>' in template-parameter-list}} + // expected-warning@-2 {{declaration does not declare anything}} +}; + +Foo<int>::UBar g1; // expected-error {{no type named 'UBar' in 'Foo<int>'}} + +class C0 { +public: + template<typename T0, typename T1 = T0 // missing closing angle bracket + struct S0 {}; // expected-error {{'S0' cannot be defined in a type specifier}} + // expected-error@-1 {{cannot combine with previous 'type-name' declaration specifier}} + // expected-error@-2 {{expected ',' or '>' in template-parameter-list}} + // expected-warning@-3 {{declaration does not declare anything}} + C0() : m(new S0<int>) {} // expected-error {{expected '(' for function-style cast or type construction}} + // expected-error@-1 {{expected expression}} + S0<int> *m; // expected-error {{expected member name or ';' after declaration specifiers}} +}; |