[Bug c++/78826] jump bypasses non-POD
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 17 00:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78826
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC 4.4.7 gives an error:
pod.cc: In function ‘void should_not_compile()’:
pod.cc:6: error: jump to label ‘label’
pod.cc:4: error: from here
pod.cc:5: error: enters scope of non-POD ‘non_pod_in_cpp03 x’
I assume GCC 4.5 stopped diagnosing it due to the revised specification which
only cares about trivial constructor or trivial destructor, not PODness. So I
suspect this change in behaviour is by design.
The type in your program does not have non-trivial constructor or non-trivial
destructor, so there is no danger in jumping over its initialization. Giving a
diagnostic here would just be pedantic and unhelpful.
More information about the Gcc-bugs
mailing list