From: Jason Merrill Date: Tue, 25 Nov 2014 14:34:43 +0000 (-0500) Subject: * pt.c (lookup_template_variable): Always unknown_type_node. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec529e2584bc299e48bf2e8b354f7fd9b6a900a8;p=gcc.git * pt.c (lookup_template_variable): Always unknown_type_node. From-SVN: r218045 --- 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;