From ec529e2584bc299e48bf2e8b354f7fd9b6a900a8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 25 Nov 2014 09:34:43 -0500 Subject: [PATCH] * pt.c (lookup_template_variable): Always unknown_type_node. From-SVN: r218045 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/pt.c | 13 ++++--------- gcc/testsuite/g++.dg/cpp1y/var-templ17.C | 9 +++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ17.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f1ef2e0b3f1..ae43baad92d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Jason Merrill + + * pt.c (lookup_template_variable): Always unknown_type_node. + 2014-11-25 Paolo Carlini PR c++/63786 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1d6b916c003..29fb2e1117e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8026,19 +8026,14 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, return ret; } -/* Return a TEMPLATE_ID_EXPR for the given variable template and ARGLIST. - If the ARGLIST refers to any template parameters, the type of the - expression is the unknown_type_node since the template-id could - refer to an explicit or partial specialization. */ +/* Return a TEMPLATE_ID_EXPR for the given variable template and ARGLIST. + The type of the expression is the unknown_type_node since the + template-id could refer to an explicit or partial specialization. */ tree lookup_template_variable (tree templ, tree arglist) { - tree type; - if (uses_template_parms (arglist)) - type = unknown_type_node; - else - type = TREE_TYPE (templ); + tree type = unknown_type_node; tsubst_flags_t complain = tf_warning_or_error; tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (templ)); arglist = coerce_template_parms (parms, arglist, templ, complain, diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ17.C b/gcc/testsuite/g++.dg/cpp1y/var-templ17.C new file mode 100644 index 00000000000..c6d97ebb368 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ17.C @@ -0,0 +1,9 @@ +// DR 1727: a specialization doesn't need to have the same type +// { dg-do compile { target c++14 } } + +template T t = 42; +template<> void* t = 0; + +template struct same; +template struct same {}; +same)> s; -- 2.30.2