https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81692
Bug ID: 81692 Summary: Bogus noreturn warning Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc at sjor dot sg Target Milestone: --- The following code will cause a -Wreturn-type warning to be emitted in the 'foo' function, even though 'foo' calls throw_exception_ which is marked __attribute__((__noreturn__)). This test case is as minimal as I could get it: the problem is gone if throw_exception_ or foo are no longer templated, or if foo does not use __PRETTY_FUNCTION__. Confirmed on gcc 6.2.0-5ubuntu12 and gcc 7.1.1 from Arch. __attribute__ ((__noreturn__)) void abort(); template <class E> __attribute__ ((__noreturn__)) void throw_exception_( E const & x, char const * current_function) { abort(); } template <typename T> int foo() { int exc; throw_exception_(exc, __PRETTY_FUNCTION__); }