diff options
author | Jason Merrill <jason@redhat.com> | 2025-07-16 11:52:45 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2025-07-22 17:34:56 -0400 |
commit | fdbc5ff61b471076cc9c758fb6c30d62f7ef1c56 (patch) | |
tree | 6d1f08a4a2c0061fd515b78e9b5fdac612811c50 /gcc/testsuite/rust/compile/macros/builtin/concat.rs | |
parent | 9feecd152fd14a7ba1f4d60fbb988864f07f967e (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
The note and example in [class.union] p6 think that placement new can be
used to change the active member of a union, but we didn't support that for
array members in constant-evaluation even after implementing P1330 and
P2747.
First I tried to address this by introducing a CLOBBER_BEGIN_OBJECT for the
entire array, but that broke the resolution of LWG3436, which invokes 'new
T[1]' for an array T, and trying to clobber a multidimensional array when
the actual object is single-dimensional breaks. So I've raised that issue
with the committee. Until that is resolved, this patch takes a simpler
approach: allow initialization of an element of an array to make the array
the active member of a union.
PR c++/121068
gcc/cp/ChangeLog:
* constexpr.cc (cxx_eval_store_expression): Allow ARRAY_REFs
when activating an array member of a union.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/constexpr-union6.C: Expect x5 to work.
* g++.dg/cpp26/constexpr-new4.C: New test.
Diffstat (limited to 'gcc/testsuite/rust/compile/macros/builtin/concat.rs')
0 files changed, 0 insertions, 0 deletions