http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54278
Travis Gockel <travis at gockelhut dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |4.7.0 Summary|"control reaches end of |__attribute__((noreturn)) |non-void function |called from destructor when | |another auto-scoped | |variable has a non-trivial | |dtor erroneously fails with | |"control reaches end of | |non-void function" at -O0 --- Comment #1 from Travis Gockel <travis at gockelhut dot com> 2012-08-16 00:06:48 UTC --- Accidentally hit enter... The key here is that ThingWithDtor is non-trivial -- if you mark ~ThingWithDtor() as =default (or remove the declaration), it will not warn. If you call a noreturn function directly instead of relying on ~Aborter(), it will not warn. If both branches of the if create an Aborter, it will not warn. Everything must be compiled with -Wreturn-type and -O0. This all compiles just fine with g++ 4.6.3. --- Using built-in specs. COLLECT_GCC=g++-4.7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.0-7ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --disable-bootstrap --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.0 (Ubuntu/Linaro 4.7.0-7ubuntu3)