https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371
Bug ID: 67371 Summary: Never executed "throw" in constexpr function fails to compile Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ldionne.2 at gmail dot com Target Milestone: --- The following code fails to compile on GCC trunk: constexpr void f() { if (false) throw; } The error is: [snip]: In function 'constexpr void f()': [snip]: error: expression '<throw-expression>' is not a constant-expression } ^ The code should compile because the throw expression is never executed inside a constexpr context. Clang indeed compiles this just fine. Live example: http://melpon.org/wandbox/permlink/V0g96xpWdO2eWGNx