Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/nontype-class72.C

raw
1 // PR c++/113800
2 // P2308R1 - Template parameter initialization
3 // { dg-do compile { target c++20 } }
4 // { dg-additional-options "-fno-implicit-constexpr" }
5 // Invalid cases.
6
7 namespace std {
8 template <typename T> class initializer_list {
9 const T *_M_array;
10 decltype (sizeof 0) _M_len;
11 };
12 }
13
14 template<auto>
15 struct X {};
16
17 struct A {
18 int i;
19 };
20
21 template<A>
22 struct B { };
23
24 struct E {};
25
26 struct I { // { dg-message "not literal" }
27 I(E) {};
28 };
29
30 template<typename T, T>
31 struct W {};
32
33 void
34 g ()
35 {
36 X<{0}> x; // { dg-error "unable to deduce" }
37
38 int i = 42; // { dg-message "not const" }
39 B<{i}> b; // { dg-error "not usable" }
40
41 W<I, {E{}}> w; // { dg-error "not a valid type for a template non-type parameter" }
42 }