Commit 86c9f54b by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/85209 (ICE with lambda and structured binding)

	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
parent a1afa75e
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...
......
......@@ -16239,7 +16239,8 @@ tsubst_decomp_names (tree decl, tree pattern_decl, tree args,
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.
......
// 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> ();
}
// 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> ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment