https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80460
Bug ID: 80460 Summary: Non-sensical fallthrough warning after [[noreturn]] function leading to __builtin_unreachable() Product: gcc Version: 7.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: thiago at kde dot org Target Milestone: --- Testcase: === [[noreturn]] void qt_assert() noexcept; inline void qt_noop() {} void f(int i) { switch (i) { case 0: ((!(!"message")) ? qt_assert() : qt_noop()); case 1: qt_noop(); } } === Prints (under -O2): <source>: In function 'void f(int)': <source>:8:49: warning: this statement may fall through [-Wimplicit-fallthrough=] ((!(!"message")) ? qt_assert() : qt_noop()); ~~~~~~~^~ <source>:9:5: note: here case 1: ^~~~ The condition !!"message" is always true, so the [[noreturn]] function qt_assert() will be called. There's no condition under which qt_noop() will be called, so there's no fallthrough possible.