xref: /llvm-project/clang/test/CXX/temp/temp.decls/temp.class.spec/p8-1y.cpp (revision 57aae07b4a31a5843fc6c808855ba138d62e7f23)
1 // RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s
2 
3 // -- The argument list of the specialization shall not be identical
4 //    to the implicit argument list of the primary template.
5 
6 template<typename T, int N, template<typename> class X> int v1;
7 template<typename T, int N, template<typename> class X> int v1<T, N, X>;
8 // expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
9 
10 template<typename...T> int v2;
11 template<typename...T> int v2<T...>;
12 // expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
13 
14 template<int...N> int v3;
15 template<int...N> int v3<N...>;
16 // expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
17 
18 template<template<typename> class...X> int v4;
19 template<template<typename> class...X> int v4<X...>;
20 // expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}
21 
22 template<typename Outer> struct X {
23   template<typename Inner> static int y;
24   // FIXME: It would be preferable to only diagnose this once.
25   template<typename Inner> static int y<Outer>; // expected-error 3{{cannot be deduced}} expected-note 3{{'Inner'}}
26   template<typename Inner> static int y<Inner>; // expected-error {{does not specialize}}
27 
28   template<typename, int> static int z;
29   template<Outer N> static int z<int, N>; // expected-error {{not implicitly convertible}}
30 };
31 template<typename Outer> template<typename Inner> int X<Outer>::y<Outer>; // expected-error {{cannot be deduced}} expected-note {{'Inner'}}
32 template<typename Outer> template<typename Inner> int X<Outer>::y<Inner>; // expected-error {{does not specialize}}
33 template<> template<typename Inner> int X<int>::y<Inner>; // expected-error {{does not specialize}} expected-note {{instantiation of}}
34 
35 X<int> xi;
36 X<int*> xf; // expected-note {{instantiation of}}
37