aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-11-25 09:34:43 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-11-25 09:34:43 -0500
commitec529e2584bc299e48bf2e8b354f7fd9b6a900a8 (patch)
treef1ae276720b4c209154822f95ded9212136d1455
parent191ec64036b11c0b56aa0d2a387e936286103d2e (diff)
downloadgcc-ec529e2584bc299e48bf2e8b354f7fd9b6a900a8.zip
gcc-ec529e2584bc299e48bf2e8b354f7fd9b6a900a8.tar.gz
gcc-ec529e2584bc299e48bf2e8b354f7fd9b6a900a8.tar.bz2
* pt.c (lookup_template_variable): Always unknown_type_node.
From-SVN: r218045
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c13
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/var-templ17.C9
3 files changed, 17 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f1ef2e0..ae43baa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-24 Jason Merrill <jason@redhat.com>
+
+ * pt.c (lookup_template_variable): Always unknown_type_node.
+
2014-11-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/63786
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1d6b916..29fb2e1 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 0000000..c6d97eb
--- /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 <class T> T t = 42;
+template<> void* t<int> = 0;
+
+template<class T, class U> struct same;
+template<class T> struct same<T,T> {};
+same<void*,decltype(t<int>)> s;