From a4296998322d3bb3b53c7412715cc2169f1d4f61 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Thu, 8 Feb 2018 16:11:39 +0000 Subject: [PATCH] [C++ PATCH] initializer_list diagnostic 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 | 5 +++++ gcc/cp/class.c | 7 +++---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/initlist93.C | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b898ba15a37..2fc35d2dea1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-02-08 Nathan Sidwell + + * class.c (finish_struct): Fix std:initializer_list diagnostic + formatting. + 2018-02-08 Paolo Carlini PR c++/83204 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 44170202abe..e48a04ade7d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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 "); + fatal_error (input_location, "definition of %qD does not match " + "%<#include %>", TYPE_NAME (t)); } input_location = saved_loc; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e989c94a5e4..6d451959f12 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-02-08 Nathan Sidwell + + * g++.dg/cpp0x/initlist93.C: Adjust diagnostic. + 2018-02-08 Richard Sandiford PR tree-optimization/84265 diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist93.C b/gcc/testsuite/g++.dg/cpp0x/initlist93.C index 84a47381f18..7a0b0219174 100644 --- a/gcc/testsuite/g++.dg/cpp0x/initlist93.C +++ b/gcc/testsuite/g++.dg/cpp0x/initlist93.C @@ -3,7 +3,7 @@ namespace std { -template class initializer_list // { dg-error "definition of std::initializer_list does not match" } +template class initializer_list // { dg-error "definition of .*std::initializer_list.* does not match" } { int *_M_array; int _M_len; -- 2.30.2