@@ -12660,7 +12660,8 @@ grokdeclarator (const cp_declarator *dec
gcc_unreachable ();
}
if (TREE_CODE (type) != TEMPLATE_TYPE_PARM
- || TYPE_IDENTIFIER (type) != auto_identifier)
+ || TYPE_IDENTIFIER (type) != auto_identifier
+ || PLACEHOLDER_TYPE_CONSTRAINTS_INFO (type))
{
if (type != error_mark_node)
{
@@ -0,0 +1,20 @@
+// CWG2635 - Constrained structured bindings
+// { dg-do compile { target c++20 } }
+
+namespace std {
+ template<typename T> struct tuple_size;
+ template<int, typename> struct tuple_element;
+}
+
+struct A {
+ int i;
+ A(int x) : i(x) {}
+ template <int I> int& get() { return i; }
+};
+
+template<> struct std::tuple_size<A> { static const int value = 2; };
+template<int I> struct std::tuple_element<I,A> { using type = int; };
+
+template<class T> concept C = true;
+C auto [x, y] = A{1}; // { dg-error "structured binding declaration cannot have type 'auto \\\[requires ::C<<placeholder>, >\\\]'" }
+ // { dg-message "type must be cv-qualified 'auto' or reference to cv-qualified 'auto'" "" { target *-*-* } .-1 }