https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61379
Bug ID: 61379 Summary: __attribute__((noreturn)) ignored on pure virtual member functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: meiomorphism at gmail dot com Created attachment 32881 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32881&action=edit test file (#include-free) Pure-virtual member functions with __attribute__((noreturn)) attached are not recognized as being noreturn. This can lead to spurious warnings. Use of [[noreturn]] rather than __attribute__((noreturn)) yields the same behavior. Tested on both Debian wheezy's gcc 4.7.2 and a locally-compiled officially-sourced gcc 4.9.0. The output of `g++ -v' for the latter is given below. To reproduce, compile the attached file with -Wall; the spurious warning > virtual-noreturn.cpp:12:1: warning: control reaches end of non-void function > [-Wreturn-type] (some context omitted) will be given. === BEGIN g++ -v output === Using built-in specs. COLLECT_GCC=/home/user/local/gcc-4.9/bin/g++ COLLECT_LTO_WRAPPER=/home/user/local/gcc-4.9/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/user/src/gcc-4.9.0/configure --prefix=/home/user/local/gcc-4.9 --with-local-prefix=/home/user/local/gcc-4.9-include --disable-bootstrap --disable-multilib : (reconfigured) /home/user/src/gcc-4.9.0/configure --prefix=/home/user/local/gcc-4.9 --with-local-prefix=/home/user/local/gcc-4.9-include --disable-bootstrap --disable-multilib --enable-languages=c,c++ Thread model: posix gcc version 4.9.0 (GCC) === END gcc -v output ===