Commit 657fea97 by Jason Merrill Committed by Jason Merrill

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
parent cfe9c753
2020-01-02 Jason Merrill <jason@redhat.com>
* pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
C++17.
2020-01-02 Jakub Jelinek <jakub@redhat.com> 2020-01-02 Jakub Jelinek <jakub@redhat.com>
PR c/90677 PR c/90677
......
...@@ -25811,7 +25811,16 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) ...@@ -25811,7 +25811,16 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
else if (TYPE_PTRMEM_P (type)) else if (TYPE_PTRMEM_P (type))
return false; return false;
else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) 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) else if (TREE_CODE (type) == TYPENAME_TYPE)
return false; return false;
else if (TREE_CODE (type) == DECLTYPE_TYPE) else if (TREE_CODE (type) == DECLTYPE_TYPE)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
template <int> struct S; template <int> struct S;
template <S> struct W { template <S> struct W { // { dg-error "class type" "" { target c++17_only } }
template <typename> static int foo(); template <typename> static int foo();
bool b = foo<int>(); bool b = foo<int>();
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment