diff options
author | Jason Merrill <jason@redhat.com> | 2022-09-23 09:07:22 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-09-29 13:50:03 -0400 |
commit | bbdb5612f6661f2c64b0c0f1d2291cb59fde2b40 (patch) | |
tree | 56b89b14d6a13be4d736ff80363a0ba9300ea9d1 /libgcc/libgcov-util.c | |
parent | 32b2eb59fb904926eff77811e08766a8ae6804a7 (diff) | |
download | gcc-bbdb5612f6661f2c64b0c0f1d2291cb59fde2b40.zip gcc-bbdb5612f6661f2c64b0c0f1d2291cb59fde2b40.tar.gz gcc-bbdb5612f6661f2c64b0c0f1d2291cb59fde2b40.tar.bz2 |
c++: fix class-valued ?: extension
When the gimplifier encounters the same TARGET_EXPR twice, it evaluates
TARGET_EXPR_INITIAL the first time and clears it so that the later
evaluation is just the temporary. With this testcase, using the extension
to treat an omitted middle operand as repeating the first operand, that led
to doing a bitwise copy of the S(1) temporary on return rather than properly
calling the copy constructor.
We can't use S(1) to initialize the return value here anyway, because we
need to materialize it into a temporary so we can convert it to bool and
determine which arm we're evaluating. So let's just treat the middle
operand as an xvalue.
PR c++/93046
gcc/cp/ChangeLog:
* call.cc (build_conditional_expr): For a?:c extension, treat
a reused class prvalue as an xvalue.
gcc/testsuite/ChangeLog:
* g++.dg/ext/cond4.C: Add runtime test.
Diffstat (limited to 'libgcc/libgcov-util.c')
0 files changed, 0 insertions, 0 deletions