On Sun, 21 Dec 2025, 19:44 Wang Jinghao, <[email protected]> wrote:
> Ignoring FORMAT_MESSAGE_IGNORE_INSERTS when retrieving system > error messages from FormatMessage may result in unexpected error messages > and > trigger new exceptions. For those like me who have no idea what this is about, this explains it: https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353 Can we add a test with error code 87? This patch changes the > std::system_category.message(int) to be the same as the flags in > gcc/plugin.cc:win32_error_msg() > > libstdc++-v3/ChangeLog: > > * src/c++11/system_error.cc: > This changelog entry is missing a description. --- > libstdc++-v3/src/c++11/system_error.cc | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/src/c++11/system_error.cc > b/libstdc++-v3/src/c++11/system_error.cc > index b9a0b2c158f..ea7b5cd1226 100644 > --- a/libstdc++-v3/src/c++11/system_error.cc > +++ b/libstdc++-v3/src/c++11/system_error.cc > @@ -162,7 +162,9 @@ namespace > char* buf = nullptr; > auto len > = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM > - | FORMAT_MESSAGE_ALLOCATE_BUFFER, > + | FORMAT_MESSAGE_ALLOCATE_BUFFER > + | FORMAT_MESSAGE_IGNORE_INSERTS > + | FORMAT_MESSAGE_MAX_WIDTH_MASK, > nullptr, > i, > LANG_USER_DEFAULT, > -- > 2.52.0 > >
