| 1 |
// PR c++/104470 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template<typename _Types> |
| 5 |
class variant |
| 6 |
{ |
| 7 |
template<typename _Tp> |
| 8 |
static constexpr int __accepted_index = 0; |
| 9 |
template<int _Np> |
| 10 |
using __to_type = int; |
| 11 |
template<typename _Tp> |
| 12 |
using __accepted_type = __to_type<__accepted_index<_Tp>>; |
| 13 |
template<typename _Tp, typename _Tj = __accepted_type<_Tp>> |
| 14 |
variant(_Tp __t) { } |
| 15 |
}; |
| 16 |
template <typename T> |
| 17 |
struct Foo |
| 18 |
{ |
| 19 |
T value; |
| 20 |
}; |
| 21 |
template <typename T> |
| 22 |
using V = variant<Foo<T>>; |
| 23 |
V e = Foo{1}; // { dg-error "" } |