Debian Codegraph @

gcc/testsuite/g++.dg/cpp26/decomp2.C

raw
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 [[gnu::deprecated]] ] = 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 // { dg-message "declared here" "" { target *-*-* } .-2 }
28 ++c;
29 ++d;
30 ++e; // { dg-warning "'e' is deprecated" }
31 auto [ f, h [[gnu::deprecated]] [[]], i [[]], j ] = b;// { 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 // { dg-message "declared here" "" { target *-*-* } .-2 }
34 ++f;
35 ++h; // { dg-warning "'h' is deprecated" }
36 ++i;
37 ++j;
38 for (auto [ k, l [[gnu::deprecated]], m, n [[]]] : z) // { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } }
39 { // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
40 // { dg-message "declared here" "" { target *-*-* } .-2 }
41 ++k;
42 ++l; // { dg-warning "'l' is deprecated" }
43 ++m;
44 ++n;
45 }
46 }