This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81508] Warning: Control reaches end of non-void function - noreturn attribute ignored if nontrivial destructor runs afterwards
- From: "juraj.orsulic at fer dot hr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Jul 2017 09:27:07 +0000
- Subject: [Bug c++/81508] Warning: Control reaches end of non-void function - noreturn attribute ignored if nontrivial destructor runs afterwards
- Auto-submitted: auto-generated
- References: <bug-81508-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81508
--- Comment #5 from Juraj Oršulić <juraj.orsulic at fer dot hr> ---
Thanks on the explanation, Jonathan - you are completely right. I have renamed
the bug title accordingly. Also, here's a further reduction of the working
example - there's no need for a switch and the conditional invocation of
LogMessageFatal.
struct S {
~S() { }
};
int flush_result();
class LogMessageFatal {
public:
~LogMessageFatal() __attribute__ ((noreturn));
};
int Flush() {
S lol;
if(flush_result()) {
return 1;
}
LogMessageFatal();
}