[C++/83287] Another overload lookup ice

https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01580.html
	PR c++/83287
	* init.c (build_raw_new_expr): Scan list for lookups to keep.

	PR c++/83287
	* g++.dg/lookup/pr83287-2.C: New.

From-SVN: r256809
This commit is contained in:
Nathan Sidwell 2018-01-17 18:11:49 +00:00 committed by Nathan Sidwell
parent bb9869d5a3
commit 4436a3ce49
4 changed files with 36 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2018-01-17 Nathan Sidwell <nathan@acm.org>
PR c++/83287
* init.c (build_raw_new_expr): Scan list for lookups to keep.
2018-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/83814

View file

@ -2325,7 +2325,12 @@ build_raw_new_expr (vec<tree, va_gc> *placement, tree type, tree nelts,
else if (init->is_empty ())
init_list = void_node;
else
init_list = build_tree_list_vec (init);
{
init_list = build_tree_list_vec (init);
for (tree v = init_list; v; v = TREE_CHAIN (v))
if (TREE_CODE (TREE_VALUE (v)) == OVERLOAD)
lookup_keep (TREE_VALUE (v), true);
}
new_expr = build4 (NEW_EXPR, build_pointer_type (type),
build_tree_list_vec (placement), type, nelts,

View file

@ -1,3 +1,8 @@
2018-01-17 Nathan Sidwell <nathan@acm.org>
PR c++/83287
* g++.dg/lookup/pr83287-2.C: New.
2018-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/83814

View file

@ -0,0 +1,20 @@
// PR c++/83287 failed to keep lookup until instantiation time
void foo ();
namespace {
void foo ();
}
template <class T>
void
bar ()
{
new T (foo); // { dg-error "cannot resolve" }
}
void
baz ()
{
bar <double> ();
}