https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80059
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This seems to fix it: --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -271,7 +271,7 @@ build_must_not_throw_expr (tree body, tree cond) cond = perform_implicit_conversion_flags (boolean_type_node, cond, tf_warning_or_error, LOOKUP_NORMAL); - cond = cxx_constant_value (cond); + cond = fold_non_dependent_expr (cond); if (integer_zerop (cond)) return body; else if (integer_onep (cond))