[PR c++/84702] ICE with default tmpl arg of overload set

https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00227.html
	PR c++/84702
	* pt.c (process_template_arg): Mark lookup_keep on a default arg.

	PR c++/84702
	* g++.dg/lookup/pr84702.C: New.

From-SVN: r258258
This commit is contained in:
Nathan Sidwell 2018-03-05 18:44:24 +00:00 committed by Nathan Sidwell
parent 537400180d
commit f7af3ad637
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2018-03-05 Nathan Sidwell <nathan@acm.org>
PR c++/84702
* pt.c (process_template_arg): Mark lookup_keep on a default arg.
2018-03-05 Marek Polacek <polacek@redhat.com>
PR c++/84707

View File

@ -4425,6 +4425,9 @@ process_template_parm (tree list, location_t parm_loc, tree parm,
pushdecl (decl);
if (defval && TREE_CODE (defval) == OVERLOAD)
lookup_keep (defval, true);
/* Build the parameter node linking the parameter declaration,
its default argument (if any), and its constraints (if any). */
parm = build_tree_list (defval, parm);

View File

@ -1,3 +1,8 @@
2018-03-05 Nathan Sidwell <nathan@acm.org>
PR c++/84702
* g++.dg/lookup/pr84702.C: New.
2018-03-05 Jakub Jelinek <jakub@redhat.com>
PR target/84564

View File

@ -0,0 +1,13 @@
// PR c++/84702 failure to mark overload to keep
// { dg-do compile { target c++11 } }
void a ();
namespace {
void a (int);
}
template<void (&b)() = a>
void c () {
c ();
}