diff options
author | Jason Merrill <jason@redhat.com> | 2020-01-26 22:58:32 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-02-08 11:14:58 -0500 |
commit | aaa26bf496a646778ac861aed124d960b5bf549f (patch) | |
tree | 1167d885bee00dad0a0f9437ebe7fcfc8d1c19cb /gcc/cp/expr.c | |
parent | 173c8defa6e82f1bc003173b6ee1e4eb2830d1c2 (diff) | |
download | gcc-aaa26bf496a646778ac861aed124d960b5bf549f.zip gcc-aaa26bf496a646778ac861aed124d960b5bf549f.tar.gz gcc-aaa26bf496a646778ac861aed124d960b5bf549f.tar.bz2 |
c++: Use constexpr to avoid wrong -Wsign-compare (PR90691).
We would like to do constexpr evaluation to avoid false positives on
warnings, but constexpr evaluation can involve function body copying that
changes DECL_UID, which breaks -fcompare-debug. So let's remember
that we need to avoid that.
PR c++/90691
* expr.c (fold_for_warn): Call maybe_constant_value.
* constexpr.c (struct constexpr_ctx): Add uid_sensitive field.
(maybe_constant_value): Add uid_sensitive parm.
(get_fundef_copy): Don't copy if it's true.
(cxx_eval_call_expression): Don't instantiate if it's true.
(cxx_eval_outermost_constant_expr): Likewise.
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r-- | gcc/cp/expr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index cfc1c7b..04e4418 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -397,6 +397,8 @@ fold_for_warn (tree x) else return f; } + else if (cxx_dialect >= cxx11) + x = maybe_constant_value (x, NULL_TREE, false, true); return c_fully_fold (x, /*for_init*/false, /*maybe_constp*/NULL); } |