fortran/openmp.cc: Fix var init and locus use to avoid uninit values [PR fortran...
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / var-templ11.C
blob5d6e0d0dcff610046c6fb6e3b2dc4553b6aed073
1 // PR c++/63201
2 // { dg-do compile { target c++14 } }
4 template <class T>
5 struct Y
7   template <class U> static U x;
8 };
10 template <class T>
11 template <class U>
12 U Y<T>::x = U();
14 template <>
15 template <class U>
16 U Y<int>::x = 42;
18 template <>
19 template <class U>
20 // odd diagnostic
21 U Y<float>::x<U> = 42; // { dg-error "partial specialization" }
23 template <>
24 template <>
25 int Y<float>::x<int> = 42; // { dg-bogus "non-member-template declaration" }
27 template <class T>
28 struct Z
30   template <class U> struct ZZ
31   {
32     template <class V> static V x;
33   };
36 template <class T>
37 template <class U>
38 template <class V>
39 V Z<T>::ZZ<U>::x = V();
41 template <>
42 template <>
43 template <class V>
44 V Z<int>::ZZ<int>::x = V();
46 template <>
47 template <class U>
48 struct Z<float>::ZZ
50   template <class V> static V x;
53 template <>
54 template <class U>
55 template <class V>
56 V Z<float>::ZZ<U>::x = V();
58 template <>
59 template <>
60 template <>
61 int Z<float>::ZZ<int>::x<int> = 42; // { dg-bogus "non-member-template declaration" }
63 int main()
65   int y = Y<int>::x<int>;
66   int z = Z<float>::ZZ<int>::x<int>;