re PR c++/63940 (C++ constexpr errors on AIX)
PR c++/63940 * constexpr.c (cxx_eval_binary_expression): Don't assume the expression was already folded. (cxx_eval_unary_expression): Likewise. From-SVN: r217738
This commit is contained in:
parent
2bf86c845a
commit
f899317ec2
2 changed files with 30 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2014-11-18 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/63940
|
||||||
|
* constexpr.c (cxx_eval_binary_expression): Don't assume the
|
||||||
|
expression was already folded.
|
||||||
|
(cxx_eval_unary_expression): Likewise.
|
||||||
|
|
||||||
2014-11-18 Marc Glisse <marc.glisse@inria.fr>
|
2014-11-18 Marc Glisse <marc.glisse@inria.fr>
|
||||||
|
|
||||||
PR libstdc++/43622
|
PR libstdc++/43622
|
||||||
|
|
|
@ -1461,9 +1461,17 @@ cxx_eval_unary_expression (const constexpr_ctx *ctx, tree t,
|
||||||
addr, non_constant_p, overflow_p,
|
addr, non_constant_p, overflow_p,
|
||||||
NULL);
|
NULL);
|
||||||
VERIFY_CONSTANT (arg);
|
VERIFY_CONSTANT (arg);
|
||||||
if (arg == orig_arg)
|
location_t loc = EXPR_LOCATION (t);
|
||||||
return t;
|
enum tree_code code = TREE_CODE (t);
|
||||||
r = fold_build1 (TREE_CODE (t), TREE_TYPE (t), arg);
|
tree type = TREE_TYPE (t);
|
||||||
|
r = fold_unary_loc (loc, code, type, arg);
|
||||||
|
if (r == NULL_TREE)
|
||||||
|
{
|
||||||
|
if (arg == orig_arg)
|
||||||
|
r = t;
|
||||||
|
else
|
||||||
|
r = build1_loc (loc, code, type, arg);
|
||||||
|
}
|
||||||
VERIFY_CONSTANT (r);
|
VERIFY_CONSTANT (r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -1488,9 +1496,18 @@ cxx_eval_binary_expression (const constexpr_ctx *ctx, tree t,
|
||||||
allow_non_constant, addr,
|
allow_non_constant, addr,
|
||||||
non_constant_p, overflow_p, NULL);
|
non_constant_p, overflow_p, NULL);
|
||||||
VERIFY_CONSTANT (rhs);
|
VERIFY_CONSTANT (rhs);
|
||||||
if (lhs == orig_lhs && rhs == orig_rhs)
|
|
||||||
return t;
|
location_t loc = EXPR_LOCATION (t);
|
||||||
r = fold_build2 (TREE_CODE (t), TREE_TYPE (t), lhs, rhs);
|
enum tree_code code = TREE_CODE (t);
|
||||||
|
tree type = TREE_TYPE (t);
|
||||||
|
r = fold_binary_loc (loc, code, type, lhs, rhs);
|
||||||
|
if (r == NULL_TREE)
|
||||||
|
{
|
||||||
|
if (lhs == orig_lhs && rhs == orig_rhs)
|
||||||
|
r = t;
|
||||||
|
else
|
||||||
|
r = build2_loc (loc, code, type, lhs, rhs);
|
||||||
|
}
|
||||||
VERIFY_CONSTANT (r);
|
VERIFY_CONSTANT (r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue