diff options
author | Jason Merrill <jason@redhat.com> | 2013-02-28 15:21:23 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-02-28 15:21:23 -0500 |
commit | 728761beb09e1d14952d08ffe18cf1494e05c782 (patch) | |
tree | 057a232c70168d39ceaf82e43e99f4fd566d83db /gcc | |
parent | 15fd8332c06b873289196e91bdc3fe9723648ca9 (diff) | |
download | gcc-728761beb09e1d14952d08ffe18cf1494e05c782.zip gcc-728761beb09e1d14952d08ffe18cf1494e05c782.tar.gz gcc-728761beb09e1d14952d08ffe18cf1494e05c782.tar.bz2 |
re PR c++/56481 (endless loop compiling a C++ file)
PR c++/56481
* semantics.c (potential_constant_expression_1): Use
cxx_eval_outermost_constant_expr rather than maybe_constant_value.
From-SVN: r196358
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 90110de..11ea5d4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-02-28 Jason Merrill <jason@redhat.com> + PR c++/56481 + * semantics.c (potential_constant_expression_1): Use + cxx_eval_outermost_constant_expr rather than maybe_constant_value. + PR c++/56243 * call.c (build_over_call): Avoid virtual lookup in a template. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 9446f83..8038aa2 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8683,10 +8683,12 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) case ROUND_MOD_EXPR: { tree denom = TREE_OPERAND (t, 1); - /* We can't call maybe_constant_value on an expression + if (!potential_constant_expression_1 (denom, rval, flags)) + return false; + /* We can't call cxx_eval_outermost_constant_expr on an expression that hasn't been through fold_non_dependent_expr yet. */ if (!processing_template_decl) - denom = maybe_constant_value (denom); + denom = cxx_eval_outermost_constant_expr (denom, true); if (integer_zerop (denom)) { if (flags & tf_error) @@ -8696,7 +8698,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) else { want_rval = true; - goto binary; + return potential_constant_expression_1 (TREE_OPERAND (t, 0), + want_rval, flags); } } @@ -8731,7 +8734,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) if (!potential_constant_expression_1 (op, rval, flags)) return false; if (!processing_template_decl) - op = maybe_constant_value (op); + op = cxx_eval_outermost_constant_expr (op, true); if (tree_int_cst_equal (op, tmp)) return potential_constant_expression_1 (TREE_OPERAND (t, 1), rval, flags); else @@ -8793,7 +8796,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) if (!potential_constant_expression_1 (tmp, rval, flags)) return false; if (!processing_template_decl) - tmp = maybe_constant_value (tmp); + tmp = cxx_eval_outermost_constant_expr (tmp, true); if (integer_zerop (tmp)) return potential_constant_expression_1 (TREE_OPERAND (t, 2), want_rval, flags); |