https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83242
Bug ID: 83242 Summary: Never executed "throw" in constexpr function fails to compile Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: benni.buch at gmail dot com Target Milestone: --- constexpr int f(){ if(true) return 0; throw 0; } int main(){ constexpr auto i = f(); } Probably related to Bug 67371 $ g++ -std=c++14 main.cpp main.cpp: In function 'constexpr int f()': main.cpp:3:11: error: expression '<throw-expression>' is not a constant expression throw 0; ^ main.cpp: In function 'int main()': main.cpp:7:25: error: 'constexpr int f()' called in a constant expression constexpr auto i = f(); ~^~ $ g++ --version g++ (GCC) 8.0.0 20171201 (experimental) Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.