]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Fix SFINAE for invalid non-type tparm types.
authorJason Merrill <jason@redhat.com>
Thu, 5 Mar 2020 15:22:25 +0000 (10:22 -0500)
committerJason Merrill <jason@redhat.com>
Thu, 5 Mar 2020 15:22:25 +0000 (10:22 -0500)
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/ChangeLog
gcc/cp/pt.c

index 6c4a7751662aee4d5ed916f1fc84eb31a9014ace..bf0d9b3f2cbd5fa825bbf16cc7f4f90c3cf2d103 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2020-03-04  Jason Merrill  <jason@redhat.com>
 
        PR c++/91607
index 43d9660ebda74a9db954858d7e446e3e240663e3..4787747b6ff2e747c1844616d5f654cccf5722e2 100644 (file)
@@ -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