Commit 8f3284a4 by Nathan Sidwell Committed by Nathan Sidwell

[C++/84812] ICE with local fn decl

https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00872.html
	PR c++/84812
	* name-lookup.c (set_local_extern_decl_linkage): Defend against
	ambiguous lookups.

	PR c++/84812
	* g++.dg/lookup/pr84812.C: New.

From-SVN: r258644
parent 25f91fda
2018-03-19 Nathan Sidwell <nathan@acm.org>
PR c++/84812
* name-lookup.c (set_local_extern_decl_linkage): Defend against
ambiguous lookups.
2018-03-16 Jakub Jelinek <jakub@redhat.com>
PR c/84910
......
......@@ -2878,7 +2878,9 @@ set_local_extern_decl_linkage (tree decl, bool shadowed)
= find_namespace_value (current_namespace, DECL_NAME (decl));
loc_value = ns_value;
}
if (loc_value == error_mark_node)
if (loc_value == error_mark_node
/* An ambiguous lookup. */
|| (loc_value && TREE_CODE (loc_value) == TREE_LIST))
loc_value = NULL_TREE;
for (ovl_iterator iter (loc_value); iter; ++iter)
......@@ -2926,7 +2928,8 @@ set_local_extern_decl_linkage (tree decl, bool shadowed)
if (ns_value == decl)
ns_value = find_namespace_value (current_namespace, DECL_NAME (decl));
if (ns_value == error_mark_node)
if (ns_value == error_mark_node
|| (ns_value && TREE_CODE (ns_value) == TREE_LIST))
ns_value = NULL_TREE;
for (ovl_iterator iter (ns_value); iter; ++iter)
......
2018-03-19 Nathan Sidwell <nathan@acm.org>
PR c++/84812
* g++.dg/lookup/pr84812.C: New.
2018-03-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/84929
......
// PR 84812. ICE determining implicit "C" linkage
struct A { void foo(); };
struct B { void foo(); };
struct C : A, B
{
void X ();
};
void C::X ()
{
void foo (); // local decl of ::foo
foo ();
}
// { dg-final { scan-assembler "_Z3foov" } }
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