Debian Codegraph @

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

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