[Bug c++/81508] Warning: Control reaches end of non-void function - noreturn attribute ignored if nontrivial destructor runs afterwards

juraj.orsulic at fer dot hr gcc-bugzilla@gcc.gnu.org
Mon Jul 24 09:27:00 GMT 2017


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();
}


More information about the Gcc-bugs mailing list