re PR c++/63528 (A variadic variable template cannot use the ::value of a variadic...
authorJason Merrill <jason@redhat.com>
Wed, 15 Oct 2014 17:42:07 +0000 (13:42 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 15 Oct 2014 17:42:07 +0000 (13:42 -0400)
PR c++/63528
* pt.c (lookup_template_variable): Call coerce_template_parms.

From-SVN: r216279

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1y/var-templ14.C [new file with mode: 0644]

index 0b1e7d899bf895c1d989243cf83d41b97fea5091..3616af3c842822b8bcd34f50cfc99964cc7063b0 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/63528
+       * pt.c (lookup_template_variable): Call coerce_template_parms.
+
 2014-10-15  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * semantics.c (is_instantiation_of_constexpr, literal_type_p,
index 390e63ee6d4eeba672c6798a95da67ef26b8c90d..2cf10f442f6822d29892c0216ecad10d2ae43855 100644 (file)
@@ -7993,6 +7993,10 @@ lookup_template_variable (tree templ, tree arglist)
     type = unknown_type_node;
   else
     type = TREE_TYPE (templ);
+  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,
+                                  /*req_all*/true, /*use_default*/true);
   return build2 (TEMPLATE_ID_EXPR, type, templ, arglist);
 }
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ14.C b/gcc/testsuite/g++.dg/cpp1y/var-templ14.C
new file mode 100644 (file)
index 0000000..c3c50d1
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/63528
+// { dg-do compile { target c++14 } }
+
+template<class...>
+struct X
+{
+  constexpr static bool value = true;
+};
+
+static_assert(X<int>::value, "");
+
+template <class... Args>
+constexpr bool X_v = X<Args...>::value;
+
+static_assert(X_v<int>, "");