c++: prev declared hidden tmpl friend inst [PR112288]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / nontype-class64.C
blobeb6489238f048255890ede52e9f1105d1d3c6a6f
1 // Testcase from P2308R1
2 // { dg-do compile { target c++20 } }
4 template<auto n> struct B { /* ... */ };
5 B<5> b1;                        // OK, template parameter type is int
6 B<'a'> b2;                      // OK, template parameter type is char
7 B<2.5> b3;                      // OK, template parameter type is double
8 B<void(0)> b4;                 // { dg-error "void" }
10 template<int i> struct C { /* ... */ };
11 C<{ 42 }> c1;  // OK
13 struct J1 {
14   J1 *self=this;
16 B<J1{}> j1;  // { dg-error "not a constant expression" }
18 struct J2 {
19   J2 *self=this;
20   constexpr J2() {}
21   constexpr J2(const J2&) {}
23 B<J2{}> j2;  // { dg-error "" }