+2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/85227
+ * decl.c (cp_finish_decomp): In a template, if the type is incomplete
+ issue a pedwarn and defer trying to do bindings.
+
2018-04-09 Jason Merrill <jason@redhat.com>
PR c++/85279 - dump_expr doesn't understand decltype.
error_at (loc, "cannot decompose lambda closure type %qT", type);
goto error_out;
}
+ else if (processing_template_decl && !COMPLETE_TYPE_P (type))
+ pedwarn (loc, 0, "structured binding refers to incomplete class type %qT",
+ type);
else
{
tree btype = find_decomp_class_base (loc, type, NULL_TREE);
+2018-04-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/85227
+ * g++.dg/cpp1z/decomp44.C: New.
+ * g++.dg/cpp1z/decomp45.C: Likewise.
+
2018-04-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/83064
--- /dev/null
+// PR c++/85227
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+extern struct A a;
+
+template<int> void foo()
+{
+ auto[i] = a; // { dg-warning "incomplete" }
+} // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 }
--- /dev/null
+// PR c++/85227
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+extern struct A a;
+
+template<int>
+void f()
+{
+ auto [x] = a; // { dg-warning "incomplete" }
+} // { dg-warning "structured bindings only available with -std=c..17 or -std=gnu..17" "" { target c++14_down } .-1 }
+
+struct A { int i; };
+
+int main()
+{
+ f<0>();
+}