Commit 7cd9cf2f by Nathan Sidwell Committed by Nathan Sidwell

[PR c++/84836] ICE with local scopes

https://gcc.gnu.org/ml/gcc-patches/2018-03/msg01082.html
	PR c++/84836
	* name-lookup.c (update_binding): Correct logic for local binding
	update.

	PR c++/84836
	* g++.dg/lookup/pr84836.C: New.

From-SVN: r258711
parent 49e4ca31
2018-03-21 Nathan Sidwell <nathan@acm.org>
PR c++/84836
* name-lookup.c (update_binding): Correct logic for local binding
update.
2018-03-21 Marek Polacek <polacek@redhat.com> 2018-03-21 Marek Polacek <polacek@redhat.com>
PR c++/71638, ICE with NSDMI and reference. PR c++/71638, ICE with NSDMI and reference.
......
...@@ -2481,21 +2481,12 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot, ...@@ -2481,21 +2481,12 @@ update_binding (cp_binding_level *level, cxx_binding *binding, tree *slot,
done: done:
if (to_val) if (to_val)
{ {
if (level->kind != sk_namespace if (level->kind == sk_namespace || to_type == decl || to_val == decl)
&& !to_type && binding->value && OVL_P (to_val)) add_decl_to_level (level, decl);
update_local_overload (binding, to_val);
else else
{ {
tree to_add = to_val; gcc_checking_assert (binding->value && OVL_P (binding->value));
update_local_overload (binding, to_val);
if (level->kind == sk_namespace)
to_add = decl;
else if (to_type == decl)
to_add = decl;
else if (TREE_CODE (to_add) == OVERLOAD)
to_add = build_tree_list (NULL_TREE, to_add);
add_decl_to_level (level, to_add);
} }
if (slot) if (slot)
......
2018-03-21 Nathan Sidwell <nathan@acm.org>
PR c++/84836
* g++.dg/lookup/pr84836.C: New.
2018-03-21 Bin Cheng <bin.cheng@arm.com> 2018-03-21 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/84969 PR tree-optimization/84969
......
// PR c++/84836
// ICE popping local binding
void foo (void)
{
struct A;
void A (int);
void A (long);
}
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