diff options
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ14.C | 15 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0b1e7d8..3616af3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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, diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 390e63e..2cf10f4 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 0000000..c3c50d1 --- /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<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>, ""); |