PR c++/85209
* pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
is not prev, if prev == decl.
* g++.dg/cpp1z/decomp39.C: New test.
* g++.dg/cpp1z/decomp40.C: New test.
From-SVN: r259156
2018-04-05 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85209
+ * pt.c (tsubst_decomp_names): Don't fail or ICE if DECL_CHAIN (decl3)
+ is not prev, if prev == decl.
+
PR c++/85208
* decl.c (start_decl): For DECL_DECOMPOSITION_P decls, don't call
maybe_apply_pragma_weak here...
if (error_operand_p (decl3))
decl = error_mark_node;
else if (decl != error_mark_node
- && DECL_CHAIN (decl3) != prev)
+ && DECL_CHAIN (decl3) != prev
+ && decl != prev)
{
gcc_assert (errorcount);
decl = error_mark_node;
2018-04-05 Jakub Jelinek <jakub@redhat.com>
+ PR c++/85209
+ * g++.dg/cpp1z/decomp39.C: New test.
+ * g++.dg/cpp1z/decomp40.C: New test.
+
PR c++/85208
* g++.dg/cpp1z/decomp41.C: New test.
--- /dev/null
+// PR c++/85209
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+template <int>
+void
+foo ()
+{
+ auto [a] = []{}; // { dg-error "cannot decompose lambda closure type" }
+} // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
+
+void
+bar ()
+{
+ foo<0> ();
+}
--- /dev/null
+// PR c++/85209
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+struct S { int a; } s;
+
+template <int>
+void
+foo ()
+{
+ auto [a] = []{ return s; } (); // { dg-warning "structured bindings only available with" "" { target c++14_down } }
+};
+
+void
+bar ()
+{
+ foo<0> ();
+}