| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "" } |
| 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> int& get() { return i; } |
| 12 |
}; |
| 13 |
|
| 14 |
template<> struct std::tuple_size<A> { static const int value = 3; }; |
| 15 |
template<int I> struct std::tuple_element<I,A> { using type = int; }; |
| 16 |
|
| 17 |
struct B { |
| 18 |
int i, j; |
| 19 |
long long k, l; |
| 20 |
} z[6]; |
| 21 |
|
| 22 |
void |
| 23 |
foo (A &a, B &b) |
| 24 |
{ |
| 25 |
auto [ c [[]], d, e [[maybe_unused]] ] = a; // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } } |
| 26 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 27 |
auto [ f, h [[maybe_unused]] [[]], i [[]], j ] = b; // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } } |
| 28 |
// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 29 |
for (auto [ k, l [[maybe_unused]], m, n [[]]] : z) // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } } |
| 30 |
; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 31 |
auto &[o[[]][[]][[]], p[[]], q[[]]] = a; // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } } |
| 32 |
; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } |
| 33 |
} |