https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89513
Bug ID: 89513 Summary: constexpr functions with function try block shouldn't be accepted at least with -pedantic in -std=c++{11,14,17} modes Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- With -std=c++{11,14,17} -pedantic-errors we should reject both of these functions, but we do reject just bar and not foo. I assume this ought to be valid C++2a (though wonder if the catch block needs to contain only valid constexpr constructs even when it is not actually ever evaluated during constexpr evaluation). constexpr bool foo () try { return true; } catch (...) { } constexpr bool bar () { try { return true; } catch (...) {} return true; } constexpr auto a = foo (); constexpr auto b = bar ();