1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
3 template <typename T
> struct A
{
5 T(A
<T
>){}; // expected-error{{member 'A' cannot have template arguments}}\
6 // expected-error2{{member 'A' has the same name as its class}}
9 A
<int> instantiate1() { return {nullptr}; } // expected-note{{in instantiation of template class 'A<int>' requested here}}
11 template <typename T
> struct B
{
13 T B
<T
>{}; // expected-error{{member 'B' cannot have template arguments}}\
14 // expected-error2{{member 'B' has the same name as its class}}
17 B
<int> instantiate2() { return {nullptr}; } // expected-note{{in instantiation of template class 'B<int>' requested here}}
19 template <typename T
> struct S
{};
21 template <typename T
> struct C
{
23 T S
<T
>{}; // expected-error{{member 'S' cannot have template arguments}}
26 C
<int> instantiate3() { return {nullptr}; }
28 template <typename T
, template <typename
> typename U
> class D
{
31 T(D
<T
, U
<T
>>) {} // expected-error{{member 'D' cannot have template arguments}}\
32 // expected-error{{expected ';' at end of declaration list}}\
33 // expected-error2{{member 'D' has the same name as its class}}
36 D
<int, S
> instantiate4() { return D
<int, S
>(nullptr); } // expected-note{{in instantiation of template class 'D<int, S>' requested here}}