From 22f309bc29de788fc686f9f98b194996b109b218 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 4 Dec 2018 19:28:27 +0000 Subject: PR c++/88184 - ICE when treating name as template-name. * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR with unknown_type_node. * g++.dg/cpp2a/fn-template17.C: New test. * g++.dg/cpp2a/fn-template18.C: New test. From-SVN: r266793 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 866fd33..d43d613 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-12-04 Marek Polacek + + PR c++/88184 - ICE when treating name as template-name. + * pt.c (lookup_template_function): Always build the TEMPLATE_ID_EXPR + with unknown_type_node. + 2018-12-04 Julian Brown * parser.c (cp_parser_oacc_wait_list): Fix error message and avoid diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a0d899f..78addc6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9068,8 +9068,6 @@ add_pending_template (tree d) tree lookup_template_function (tree fns, tree arglist) { - tree type; - if (fns == error_mark_node || arglist == error_mark_node) return error_mark_node; @@ -9090,11 +9088,7 @@ lookup_template_function (tree fns, tree arglist) return fns; } - type = TREE_TYPE (fns); - if (TREE_CODE (fns) == OVERLOAD || !type) - type = unknown_type_node; - - return build2 (TEMPLATE_ID_EXPR, type, fns, arglist); + return build2 (TEMPLATE_ID_EXPR, unknown_type_node, fns, arglist); } /* Within the scope of a template class S, the name S gets bound -- cgit v1.1