https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81508
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-07-22 Known to work| |7.1.0 Ever confirmed|0 |1 Known to fail| |6.4.1 --- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- So the bug is that GCC 6 ignores the noreturn attribute when there's a local variable with a nontrivial destructor that runs after the noreturn function: struct S { ~S() { } }; int flush_result(); class LogMessageFatal { public: ~LogMessageFatal() __attribute__ ((noreturn)); }; int Flush() { S lol; switch (flush_result()) { case 0: LogMessageFatal(); case 1: return 1; } LogMessageFatal(); }