https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78826
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Krzysztof Laskowski from comment #3) > (In reply to Jonathan Wakely from comment #2) > > I assume GCC 4.5 stopped diagnosing it due to the revised specification > > which only cares about trivial constructor or trivial destructor, not > > PODness. > I couldn't actually find any clause allowing jump over trivially constructed > variable in ISO/IEC 14882:1998 nor ISO/IEC 14882:2003. Moreover, icc (13, > 16, 17) and clang (3.0-3.9) warn and err, respectively, on example. I didn't suggest you'd find it in C++03. > It seems to correlate with introducing c++0x support in gcc. Yes, obviously. Because the refined rule was introduced for C++11. That's what I meant by revised specification. > https://gcc.gnu.org/gcc-4.5/changes.html > "Diagnostics that used to complain about passing non-POD types to ... or > jumping past the declaration of a non-POD variable now check for triviality > rather than PODness, as per C++0x." So it's even documented as being deliberate, isn't that clear? > > Giving a diagnostic here would just be pedantic and unhelpful. > I agree it's harmless to bypass trivially constructed variable. Does it mean > that it's a deliberate deviation from standard for the sake of ease of c++11 > implementation at the cost of portability/conformance? No, not for the ease of implementation. For the benefit of users. I repeat: Giving a diagnostic here would just be pedantic and unhelpful. The old rule doesn't prevent bugs, it doesn't make code faster, it has no advantages. The only reason the C++03 rule was in terms of POD was because we didn't have a better property to use. What matters is whether non-trivial initialization or destruction gets bypassed, and with modern C++ we are able to express the rule more precisely. Jason, do you see any advantage to making this a pedwarn for -std=c++98, or should we just close as WONTFIX?