[Bug libstdc++/104019] Testsuite 17_intro/headers/c++2020/stdc++_multiple_inclusion.cc failures
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 24 12:23:02 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104019
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The warning is correct, because with -fno-exceptions the try-block expands to:
if (__in.good())
if (true) // expanded from __try
{
// ...
}
if (false) // expanded from __catch(__cxxabiv1::__forced_unwind&)
{
// ...
}
if (false) // expanded from __catch(...)
{
// ...
}
And as the warning says, the if (false) condition is indented as though part of
the outer if-statement.
The code is actually fine, but it would break if we ever added an else to the
outer if:
if (__in.good())
__try
{
// ...
}
__catch(__cxxabiv1::__forced_unwind&)
{
// ...
}
__catch(...)
{
// ...
}
else // uh-oh, binds to the last __catch
It's probably safest to add braces around the try-block.
More information about the Gcc-bugs
mailing list