From f7af3ad6372ccc17f9d3d43566298ac843adfd67 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 5 Mar 2018 18:44:24 +0000 Subject: [PATCH] [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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lookup/pr84702.C | 13 +++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lookup/pr84702.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 001cb6a559a..3218814124e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-03-05 Nathan Sidwell + + PR c++/84702 + * pt.c (process_template_arg): Mark lookup_keep on a default arg. + 2018-03-05 Marek Polacek PR c++/84707 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c81bd5094d9..89024c10fe2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e80a72802ee..9f9afb0df12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-05 Nathan Sidwell + + PR c++/84702 + * g++.dg/lookup/pr84702.C: New. + 2018-03-05 Jakub Jelinek PR target/84564 diff --git a/gcc/testsuite/g++.dg/lookup/pr84702.C b/gcc/testsuite/g++.dg/lookup/pr84702.C new file mode 100644 index 00000000000..6b9e1b4e780 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr84702.C @@ -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 c () { + c (); +} -- 2.30.2