This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] initializer_list diagnostic


when working on 84263 I noticed this initializer_list diagnostic wasn't correctly formatted. Fixing thusly.

nathan
--
Nathan Sidwell
2018-02-08  Nathan Sidwell  <nathan@acm.org>

	* class.c (finish_struct): Fix std:initializer_list diagnostic
	formatting.

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

Index: cp/class.c
===================================================================
--- cp/class.c	(revision 257482)
+++ cp/class.c	(working copy)
@@ -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: testsuite/g++.dg/cpp0x/initlist93.C
===================================================================
--- testsuite/g++.dg/cpp0x/initlist93.C	(revision 257482)
+++ testsuite/g++.dg/cpp0x/initlist93.C	(working copy)
@@ -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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]