From 657fea973b000000350c99de9e67bff0438d1503 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 3 Jan 2020 17:10:25 -0500 Subject: Reject class template placeholder as non-type template parm type in C++17. * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in C++17. From-SVN: r279870 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 35b954ca..9b607b2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-01-02 Jason Merrill + + * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in + C++17. + 2020-01-02 Jakub Jelinek PR c/90677 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5b12aa6..bc23e9e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25811,7 +25811,16 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) else if (TYPE_PTRMEM_P (type)) return false; else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) - return false; + { + if (CLASS_PLACEHOLDER_TEMPLATE (type) && cxx_dialect < cxx2a) + { + if (complain & tf_error) + error ("non-type template parameters of deduced class type only " + "available with %<-std=c++2a%> or %<-std=gnu++2a%>"); + return true; + } + return false; + } else if (TREE_CODE (type) == TYPENAME_TYPE) return false; else if (TREE_CODE (type) == DECLTYPE_TYPE) -- cgit v1.1