Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/var-templ84a.C

raw
1 // PR c++/71954
2 // A version of var-templ84.C where the partial specializations depend on
3 // outer template parameters.
4 // { dg-do compile { target c++14 } }
5
6 template<class T>
7 struct A {
8 template<class U, class V> static const int var = 0;
9 template<class U> static const int var<U*, T> = 1;
10 template<class U> static const int var<const U*, T> = 2;
11 };
12
13 static_assert(A<int>::var<int, int> == 0, "");
14 static_assert(A<int>::var<int*, int> == 1, "");
15 static_assert(A<int>::var<const int*, int> == 2, "");
16
17 static_assert(A<int>::var<int, char> == 0, "");
18 static_assert(A<int>::var<int*, char> == 0, "");
19 static_assert(A<int>::var<const int*, char> == 0, "");