[C++ PATCH] initializer_list diagnostic
authorNathan Sidwell <nathan@acm.org>
Thu, 8 Feb 2018 16:11:39 +0000 (16:11 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 8 Feb 2018 16:11:39 +0000 (16:11 +0000)
https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00434.html
* class.c (finish_struct): Fix std:initializer_list diagnostic
formatting.

* g++.dg/cpp0x/initlist93.C: Adjust diagnostic.

From-SVN: r257496

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist93.C

index b898ba1..2fc35d2 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-08  Nathan Sidwell  <nathan@acm.org>
+
+       * class.c (finish_struct): Fix std:initializer_list diagnostic
+       formatting.
+
 2018-02-08  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/83204
index 4417020..e48a04a 100644 (file)
@@ -7062,7 +7062,7 @@ finish_struct (tree t, tree attributes)
       /* People keep complaining that the compiler crashes on an invalid
         definition of initializer_list, so I guess we should explicitly
         reject it.  What the compiler internals care about is that it's a
-        template and has a pointer field followed by an integer field.  */
+        template and has a pointer field followed by size_type field.  */
       bool ok = false;
       if (processing_template_decl)
        {
@@ -7075,9 +7075,8 @@ finish_struct (tree t, tree attributes)
            }
        }
       if (!ok)
-       fatal_error (input_location,
-                    "definition of std::initializer_list does not match "
-                    "#include <initializer_list>");
+       fatal_error (input_location, "definition of %qD does not match "
+                    "%<#include <initializer_list>%>", TYPE_NAME (t));
     }
 
   input_location = saved_loc;
index e989c94..6d45195 100644 (file)
@@ -1,3 +1,7 @@
+2018-02-08  Nathan Sidwell  <nathan@acm.org>
+
+       * g++.dg/cpp0x/initlist93.C: Adjust diagnostic.
+
 2018-02-08  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR tree-optimization/84265
index 84a4738..7a0b021 100644 (file)
@@ -3,7 +3,7 @@
 
 namespace std
 {
-template <class> class initializer_list // { dg-error "definition of std::initializer_list does not match" }
+template <class> class initializer_list // { dg-error "definition of .*std::initializer_list.* does not match" }
 {
   int *_M_array;
   int _M_len;