diff options
author | Markus Trippelsdorf <markus@trippelsdorf.de> | 2015-08-29 18:51:26 +0000 |
---|---|---|
committer | Markus Trippelsdorf <trippels@gcc.gnu.org> | 2015-08-29 18:51:26 +0000 |
commit | ce9657302380f236754ad11d6b8d0f0109075e37 (patch) | |
tree | 813dae7e59ddb927d2ea8535efd5aa49086dc622 /gcc/cp | |
parent | 04ffad35321aaebeff3ffa8764d26454d93db59e (diff) | |
download | gcc-ce9657302380f236754ad11d6b8d0f0109075e37.zip gcc-ce9657302380f236754ad11d6b8d0f0109075e37.tar.gz gcc-ce9657302380f236754ad11d6b8d0f0109075e37.tar.bz2 |
Fix c++/67371 (issues with throw in constexpr)
As PR67371 shows gcc currently rejects all throw statements in
constant-expressions, even when they are never executed.
PR c++/67371
* constexpr.c (potential_constant_expression_1): Remove IF_STMT
case. Move label to COND_EXPR case. Remove checking of
SWITCH_STMT_BODY.
From-SVN: r227323
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 14 |
2 files changed, 10 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5a3398..7cbfa65 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-08-29 Markus Trippelsdorf <markus@trippelsdorf.de> + + PR c++/67371 + * constexpr.c (potential_constant_expression_1): Remove IF_STMT + case. Move label to COND_EXPR case. Remove checking of + SWITCH_STMT_BODY. + 2015-08-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/63693 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 1eacb8b..0ff9b088 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4273,15 +4273,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, return false; return true; - case IF_STMT: - if (!RECUR (IF_COND (t), rval)) - return false; - if (!RECUR (THEN_CLAUSE (t), any)) - return false; - if (!RECUR (ELSE_CLAUSE (t), any)) - return false; - return true; - case DO_STMT: if (!RECUR (DO_COND (t), rval)) return false; @@ -4310,8 +4301,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, case SWITCH_STMT: if (!RECUR (SWITCH_STMT_COND (t), rval)) return false; - if (!RECUR (SWITCH_STMT_BODY (t), any)) - return false; + /* FIXME we don't check SWITCH_STMT_BODY currently, because even + unreachable labels would be checked. */ return true; case STMT_EXPR: @@ -4592,6 +4583,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, return false; return true; + case IF_STMT: case COND_EXPR: case VEC_COND_EXPR: /* If the condition is a known constant, we know which of the legs we |