Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/decomp6.C

raw
1 // CWG2635 - Constrained structured bindings
2 // { dg-do compile { target c++20 } }
3 // { dg-options "-pedantic" }
4
5 namespace std {
6 template<typename T> struct tuple_size;
7 template<int, typename> struct tuple_element;
8 }
9
10 struct A {
11 int i;
12 A(int x) : i(x) {}
13 template <int I> int& get() { return i; }
14 };
15
16 template<> struct std::tuple_size<A> { static const int value = 2; };
17 template<int I> struct std::tuple_element<I,A> { using type = int; };
18
19 template<class T> concept C = true;
20 C auto [x, y] = A{1}; // { dg-warning "structured binding declaration cannot have constrained 'auto' type 'auto \\\[requires ::C<<placeholder>, >\\\]'" }