aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp26/decomp1.C
blob: b3c241f1d3af0fd33f1df1607b564ab04aacd133 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// { dg-do compile { target c++11 } }
// { dg-options "" }

namespace std {
  template<typename T> struct tuple_size;
  template<int, typename> struct tuple_element;
}

struct A {
  int i;
  template <int I> int& get() { return i; }
};

template<> struct std::tuple_size<A> { static const int value = 3; };
template<int I> struct std::tuple_element<I,A> { using type = int; };

struct B {
  int i, j;
  long long k, l;
} z[6];

void
foo (A &a, B &b)
{
  auto [ c [[]], d, e [[maybe_unused]] ] = a;		// { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } }
							// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
  auto [ f, h [[maybe_unused]] [[]], i [[]], j ] = b;	// { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } }
							// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
  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 } } }
    ;							// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
  auto &[o[[]][[]][[]], p[[]], q[[]]] = a;		// { dg-warning "structured bindings with attributed identifiers only available with" "" { target { c++17 && c++23_down } } }
    ;							// { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
}