| 1 |
// PR c++/99650 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
namespace std { |
| 5 |
template<typename T> struct tuple_size; |
| 6 |
template<int, typename> struct tuple_element; |
| 7 |
} |
| 8 |
|
| 9 |
struct A { |
| 10 |
int i; |
| 11 |
template <int I> void get() { } |
| 12 |
}; |
| 13 |
|
| 14 |
template<> struct std::tuple_size<A> { static const int value = 2; }; |
| 15 |
template<int I> struct std::tuple_element<I,A> { using type = void; }; |
| 16 |
|
| 17 |
A a = { 42 }; |
| 18 |
auto [ x, y ] = a; // { dg-error ".std::tuple_element<0, A>::type. is .void." } |
| 19 |
// { dg-message "in initialization of structured binding variable 'x'" "" { target *-*-* } .-1 } |