Commit 72a7649a by Nathan Sidwell Committed by Nathan Sidwell

[PR C++/87904] lookup ICE

https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00468.html
	PR c++/87904
	* cp-tree.h (struct tree_overload): Fix comment.
	* tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.

	PR c++/87904
	* g++.dg/lookup/pr87904.C: New.

From-SVN: r265879
parent 38f54eec
2018-11-07 Nathan Sidwell <nathan@acm.org>
PR c++/87904
* cp-tree.h (struct tree_overload): Fix comment.
* tree.c (ovl_iterator::reveal_node): Propagate OVL_DEDUP_P.
2018-11-04 Jason Merrill <jason@redhat.com> 2018-11-04 Jason Merrill <jason@redhat.com>
Implement UDL changes from P0732R2. Implement UDL changes from P0732R2.
......
...@@ -723,8 +723,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t; ...@@ -723,8 +723,7 @@ typedef struct ptrmem_cst * ptrmem_cst_t;
#define OVL_SINGLE_P(NODE) \ #define OVL_SINGLE_P(NODE) \
(TREE_CODE (NODE) != OVERLOAD || !OVL_CHAIN (NODE)) (TREE_CODE (NODE) != OVERLOAD || !OVL_CHAIN (NODE))
/* OVL_HIDDEN_P nodes come first, then OVL_USING_P nodes, then regular /* OVL_HIDDEN_P nodes come before other nodes. */
fns. */
struct GTY(()) tree_overload { struct GTY(()) tree_overload {
struct tree_common common; struct tree_common common;
......
...@@ -2261,13 +2261,17 @@ ovl_iterator::reveal_node (tree overload, tree node) ...@@ -2261,13 +2261,17 @@ ovl_iterator::reveal_node (tree overload, tree node)
OVL_HIDDEN_P (node) = false; OVL_HIDDEN_P (node) = false;
if (tree chain = OVL_CHAIN (node)) if (tree chain = OVL_CHAIN (node))
if (TREE_CODE (chain) == OVERLOAD if (TREE_CODE (chain) == OVERLOAD)
&& (OVL_USING_P (chain) || OVL_HIDDEN_P (chain)))
{ {
/* The node needs moving, and the simplest way is to remove it if (OVL_HIDDEN_P (chain))
and reinsert. */ {
overload = remove_node (overload, node); /* The node needs moving, and the simplest way is to remove it
overload = ovl_insert (OVL_FUNCTION (node), overload); and reinsert. */
overload = remove_node (overload, node);
overload = ovl_insert (OVL_FUNCTION (node), overload);
}
else if (OVL_DEDUP_P (chain))
OVL_DEDUP_P (node) = true;
} }
return overload; return overload;
} }
......
2018-11-07 Nathan Sidwell <nathan@acm.org>
PR c++/87904
* g++.dg/lookup/pr87904.C: New.
2018-11-07 Uros Bizjak <ubizjak@gmail.com> 2018-11-07 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/pr87874.c: Compile only for int128 effective target. * gcc.dg/pr87874.c: Compile only for int128 effective target.
......
// PR c++ 87904 ICE failing to initiate deduping
namespace X {
void Foo (char);
}
struct B {
friend void Foo (int);
};
using X::Foo;
void Foo (float);
void Foo(int);
void frob ()
{
using namespace X;
Foo (1);
}
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