gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr15.C
raw| 1 | // PR c++/115114 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | struct X {} x; |
| 5 | struct Y {} y; |
| 6 | |
| 7 | template<class T, class U> |
| 8 | struct A : T { |
| 9 | U m; |
| 10 | }; |
| 11 | |
| 12 | using ty1 = decltype(A{x, 42}); // OK |
| 13 | using ty1 = decltype(A(x, 42)); // OK, used to fail |
| 14 | using ty1 = A<X, int>; |
| 15 | |
| 16 | template<class T, class U = int, class V = int> |
| 17 | struct B : T, V { |
| 18 | U m = 42; |
| 19 | }; |
| 20 | |
| 21 | using ty2 = decltype(B{x, y}); // OK |
| 22 | using ty2 = decltype(B(x, y)); // OK, used to fail |
| 23 | using ty2 = B<X, int, Y>; |