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.