Commit e83bc9d7 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/85210 (ICE with broken structured binding in template)

	PR c++/85210
	* pt.c (tsubst_decomp_names): Return error_mark_node and assert
	errorcount is set if tsubst doesn't return a VAR_DECL.

	* g++.dg/cpp1z/decomp42.C: New test.

From-SVN: r259181
parent cb731872
2018-04-06 Jakub Jelinek <jakub@redhat.com>
PR c++/85210
* pt.c (tsubst_decomp_names): Return error_mark_node and assert
errorcount is set if tsubst doesn't return a VAR_DECL.
2018-04-06 David Malcolm <dmalcolm@redhat.com>
PR c++/85021
......
......@@ -16235,6 +16235,12 @@ tsubst_decomp_names (tree decl, tree pattern_decl, tree args,
DECL_HAS_VALUE_EXPR_P (decl2) = 1;
if (VAR_P (decl3))
DECL_TEMPLATE_INSTANTIATED (decl3) = 1;
else
{
gcc_assert (errorcount);
decl = error_mark_node;
continue;
}
maybe_push_decl (decl3);
if (error_operand_p (decl3))
decl = error_mark_node;
......
2018-04-06 Jakub Jelinek <jakub@redhat.com>
PR c++/85210
* g++.dg/cpp1z/decomp42.C: New test.
2018-04-06 David Malcolm <dmalcolm@redhat.com>
PR c++/85021
......
// PR c++/85210
// { dg-do compile { target c++11 } }
// { dg-options "" }
struct A { int i; };
template <int>
void
foo (int j)
{
auto [j] = A{j}; // { dg-error "shadows a parameter" }
} // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 }
void
bar ()
{
foo<0> (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