diff mbox series

[pushed,GCC9] c++: Fix SFINAE for invalid non-type tparm types.

Message ID 20200305155232.28728-1-jason@redhat.com
State New
Headers show
Series [pushed,GCC9] c++: Fix SFINAE for invalid non-type tparm types. | expand

Commit Message

Jason Merrill March 5, 2020, 3:52 p.m. UTC
Just missing the usual SFINAE pattern here.  This was fixed for GCC 10 as a
drive-by in r277902.

gcc/cp/ChangeLog
2020-03-05  Jason Merrill  <jason@redhat.com>

	PR c++/90338
	* pt.c (invalid_nontype_parm_type_p): Check complain for non-literal
	and mutable errors.
---
 gcc/cp/pt.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 43d9660ebda..4787747b6ff 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25341,15 +25341,20 @@  invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
 	return true;
       if (!literal_type_p (type))
 	{
-	  error ("%qT is not a valid type for a template non-type parameter "
-		 "because it is not literal", type);
-	  explain_non_literal_class (type);
+	  if (complain & tf_error)
+	    {
+	      auto_diagnostic_group d;
+	      error ("%qT is not a valid type for a template non-type parameter "
+		     "because it is not literal", type);
+	      explain_non_literal_class (type);
+	    }
 	  return true;
 	}
       if (cp_has_mutable_p (type))
 	{
-	  error ("%qT is not a valid type for a template non-type parameter "
-		 "because it has a mutable member", type);
+	  if (complain & tf_error)
+	    error ("%qT is not a valid type for a template non-type parameter "
+		   "because it has a mutable member", type);
 	  return true;
 	}
       /* FIXME check op<=> and strong structural equality once spaceship is