From a0272f8660df5511398c6859bbf8636a6a78f16b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 15 Oct 2014 13:42:07 -0400 Subject: [PATCH] re PR c++/63528 (A variadic variable template cannot use the ::value of a variadic trait) PR c++/63528 * pt.c (lookup_template_variable): Call coerce_template_parms. From-SVN: r216279 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 4 ++++ gcc/testsuite/g++.dg/cpp1y/var-templ14.C | 15 +++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0b1e7d899bf..3616af3c842 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-10-15 Jason Merrill + + PR c++/63528 + * pt.c (lookup_template_variable): Call coerce_template_parms. + 2014-10-15 Paolo Carlini * semantics.c (is_instantiation_of_constexpr, literal_type_p, diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 390e63ee6d4..2cf10f442f6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..c3c50d1266c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ14.C @@ -0,0 +1,15 @@ +// PR c++/63528 +// { dg-do compile { target c++14 } } + +template +struct X +{ + constexpr static bool value = true; +}; + +static_assert(X::value, ""); + +template +constexpr bool X_v = X::value; + +static_assert(X_v, ""); -- 2.30.2