[Bug c++/67371] Never executed "throw" in constexpr function fails to compile

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Aug 28 08:43:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
The fix might be as simple as:

diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 1eacb8be9a44..7016b347a79c 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4324,7 +4324,6 @@ potential_constant_expression_1 (tree t, bool want_rval,
bool strict,
     case VEC_NEW_EXPR:
     case DELETE_EXPR:
     case VEC_DELETE_EXPR:
-    case THROW_EXPR:
     case OMP_ATOMIC:
     case OMP_ATOMIC_READ:
     case OMP_ATOMIC_CAPTURE_OLD:
@@ -4629,6 +4628,9 @@ potential_constant_expression_1 (tree t, bool want_rval,
bool strict,
       /* We can see these in statement-expressions.  */
       return true;

+    case THROW_EXPR:
+      return true;
+
     default:
       if (objc_is_property_ref (t))
        return false;



More information about the Gcc-bugs mailing list