From 37978db4a756f65b2e787837b273f773ec4aeae7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 2 Apr 2015 12:43:02 -0400 Subject: [PATCH] re PR c++/65625 (ICE in make_typename_type, at cp/decl.c:3499) PR c++/65625 * decl.c (make_typename_type): Handle seeing a variable template. From-SVN: r221842 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 4 ++-- gcc/testsuite/g++.dg/cpp1y/var-templ23.C | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ23.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d3dbd671ed1..6f300fb20da 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-01 Jason Merrill + + PR c++/65625 + * decl.c (make_typename_type): Handle seeing a variable template. + 2015-04-01 Paolo Carlini PR c++/56100 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 31b8e0cf50a..c4731ae2416 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3480,9 +3480,9 @@ make_typename_type (tree context, tree name, enum tag_types tag_type, if (TREE_CODE (name) == TEMPLATE_ID_EXPR) { name = TREE_OPERAND (name, 0); - if (TREE_CODE (name) == TEMPLATE_DECL) + if (DECL_TYPE_TEMPLATE_P (name)) name = TREE_OPERAND (fullname, 0) = DECL_NAME (name); - else if (TREE_CODE (name) == OVERLOAD) + if (TREE_CODE (name) != IDENTIFIER_NODE) { if (complain & tf_error) error ("%qD is not a type", name); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ23.C b/gcc/testsuite/g++.dg/cpp1y/var-templ23.C new file mode 100644 index 00000000000..a5b19d28d6c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ23.C @@ -0,0 +1,7 @@ +// PR c++/65625 +// { dg-do compile { target c++14 } } + +namespace std { + template int declval; + typename std::declval<> d; // { dg-error "not a type" } +} -- 2.30.2