https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96155
Bug ID: 96155 Summary: "throw" that is not executed in constexpr function fails to compile Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: r-gcc at mail dot uk Target Milestone: --- This fails to compile on gcc trunk, while the same code compiles fine in clang: constexpr bool foo() { for(int i = 0; i != 5; ++i) { if(i == 3) return false; } throw 5; return true; } this is the message I am getting: error: expression ‘<throw-expression>’ is not a constant expression live example: https://godbolt.org/z/eqqr4f