gcc/testsuite/g++.dg/cpp1z/class-deduction92.C
raw| 1 | // PR c++/79501 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | template<auto V> |
| 5 | struct X { |
| 6 | template<class T, auto> |
| 7 | struct B { T t; }; |
| 8 | |
| 9 | template<class T> B(T, decltype(V)=V) -> B<const T, V>; |
| 10 | |
| 11 | auto foo() { return B{V}; } |
| 12 | }; |
| 13 | |
| 14 | X<42> x; |
| 15 | using type = decltype(x.foo()); |
| 16 | using type = decltype(decltype(x)::B{42}); |
| 17 | using type = X<42>::B<const int, 42>; |