https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91923
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This patch implements that suggestion:
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e5d64989b32..bd8b2400b86 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25233,7 +25233,7 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t
complain)
return false;
else if (CLASS_TYPE_P (type))
{
- if (cxx_dialect < cxx2a)
+ if (cxx_dialect < cxx2a && (complain & tf_error))
{
error ("non-type template parameters of class type only available "
"with %<-std=c++2a%> or %<-std=gnu++2a%>");