diff options
author | Jason Merrill <jason@redhat.com> | 2020-02-10 14:05:06 +0100 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-02-11 09:17:42 +0100 |
commit | dfffecb802681fbdb56629d3bdd96491ac660be0 (patch) | |
tree | c39d43ce40c0895261f2d7993ac4b5a8c783bcba /gcc/cp/method.c | |
parent | a6ee556c7659877bb59b719f11ca2153e86ded59 (diff) | |
download | gcc-dfffecb802681fbdb56629d3bdd96491ac660be0.zip gcc-dfffecb802681fbdb56629d3bdd96491ac660be0.tar.gz gcc-dfffecb802681fbdb56629d3bdd96491ac660be0.tar.bz2 |
c++: Fix static initialization from <=>.
Constant evaluation of genericize_spaceship produced a CONSTRUCTOR, which we
then wanted to bind to a reference, which we can't do. So wrap the result
in a TARGET_EXPR so we get something with an address.
We also need to handle treating the result of cxx_eval_binary_expression as
a glvalue for SPACESHIP_EXPR.
My earlier change to add uid_sensitive to maybe_constant_value was wrong; we
don't even look at the cache when manifestly_const_eval, and I failed to
adjust the later call to cxx_eval_outermost_constant_expr.
gcc/cp/ChangeLog
2020-02-11 Jason Merrill <jason@redhat.com>
PR c++/93650
PR c++/90691
* constexpr.c (maybe_constant_value): Correct earlier change.
(cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
* method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r-- | gcc/cp/method.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index fef19e1..cfc37bc 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1075,6 +1075,9 @@ genericize_spaceship (tree type, tree op0, tree op1) comp = fold_build2 (EQ_EXPR, boolean_type_node, op0, op1); r = fold_build3 (COND_EXPR, type, comp, eq, r); + /* Wrap the whole thing in a TARGET_EXPR like build_conditional_expr_1. */ + r = get_target_expr (r); + return r; } |