From 117ad0be08050242d0235b586dc431038f04dcf0 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 15 Feb 2018 14:46:13 -0500 Subject: [PATCH] PR c++/84376 - ICE with omitted template arguments. * pt.c (dguide_name_p): Check for IDENTIFIER_NODE. From-SVN: r257706 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 3 ++- gcc/testsuite/g++.dg/cpp1z/class-deduction47.C | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction47.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5ecc8ab2672..58073748315 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2018-02-15 Jason Merrill + PR c++/84376 - ICE with omitted template arguments. + * pt.c (dguide_name_p): Check for IDENTIFIER_NODE. + PR c++/84368 - wrong error with local variable in variadic lambda. * pt.c (tsubst_pack_expansion): Fix handling of non-packs in local_specializations. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cd1aed8d677..268cfe5a454 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25454,7 +25454,8 @@ dguide_name (tree tmpl) bool dguide_name_p (tree name) { - return (TREE_TYPE (name) + return (TREE_CODE (name) == IDENTIFIER_NODE + && TREE_TYPE (name) && !strncmp (IDENTIFIER_POINTER (name), dguide_base, strlen (dguide_base))); } diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C new file mode 100644 index 00000000000..3e47f58e698 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction47.C @@ -0,0 +1,7 @@ +// PR c++/84376 + +template struct A {}; + +template T foo() { return T(); } + +template<> A foo(); // { dg-error "A" } -- 2.30.2