Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.expl.spec / p17.cpp
blob1b039627a1d3a94e184ebd5a5a9d0a785a60ee73
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<class T1>
3 class A {
4 template<class T2> class B {
5 void mf();
6 };
7 };
9 template<> template<> class A<int>::B<double>;
10 template<> template<> void A<char>::B<char>::mf();
12 template<> void A<char>::B<int>::mf(); // expected-error{{requires 'template<>'}}
14 namespace test1 {
15 template <class> class A {
16 static int foo;
17 static int bar;
19 typedef A<int> AA;
21 template <> int AA::foo = 0;
22 int AA::bar = 1; // expected-error {{template specialization requires 'template<>'}}
23 int A<float>::bar = 2; // expected-error {{template specialization requires 'template<>'}}
25 template <> class A<double> {
26 public:
27 static int foo;
28 static int bar;
31 typedef A<double> AB;
32 template <> int AB::foo = 0; // expected-error{{extraneous 'template<>'}}
33 int AB::bar = 1;
36 namespace GH54151 {
38 struct S {
39 int i<0>; // expected-error {{member 'i' cannot have template arguments}}
40 int j<int>; // expected-error {{member 'j' cannot have template arguments}}
42 static int k<12>; // expected-error {{template specialization requires 'template<>'}} \
43 expected-error{{no variable template matches specialization}}
44 void f<12>(); // expected-error {{template specialization requires 'template<>'}} \
45 // expected-error {{no function template matches function template specialization 'f'}}
48 template <typename T, int N>
49 struct U {
50 int i<N>; // expected-error {{member 'i' cannot have template arguments}}
51 int j<T>; // expected-error {{member 'j' cannot have template arguments}}
54 } // namespace GH54151