llvm-project/clang/test/SemaCXX/invalid-template-params.cpp
Haojian Wu 6898d8413f Reland "nullptr returned from ActOnTag() is not a valid result"
The commit was reverted in 346e1c43a11b8af5a818dac321f83f043862c1ec as
part of the f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee revert.
2023-01-18 12:41:44 +01:00

24 lines
1.2 KiB
C++

// 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}}
// expected-note@-2 {{forward declaration of 'UBar'}}
void foo1(); // expected-error {{non-type template parameter has incomplete type 'class UBar'}}
// expected-error@-1 {{expected ',' or '>' in template-parameter-list}}
// expected-error@-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 {{expected ',' or '>' in template-parameter-list}}
// expected-error@-2 {{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}}
};