diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-09-14 11:22:12 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-09-14 11:22:12 -0400 |
commit | de07cff96abd43f6f65dcf333958899c2ec42598 (patch) | |
tree | 05fbbb6484dff791c6a2a5fd8f82ad60ba12fe00 /gcc/fortran/resolve.c | |
parent | 818c505188ff5cd8eb048eb0e614c4ef732225bd (diff) | |
download | gcc-de07cff96abd43f6f65dcf333958899c2ec42598.zip gcc-de07cff96abd43f6f65dcf333958899c2ec42598.tar.gz gcc-de07cff96abd43f6f65dcf333958899c2ec42598.tar.bz2 |
c++: empty union member activation during constexpr [PR102163]
Here, the union's constructor is defined to activate its empty data
member _M_rest, but during constexpr evaluation of this constructor the
subobject constructor call O::O(&_M_rest, 42) doesn't produce a side
effect that actually activates the member, so the union still appears
uninitialized after its constructor has run. This patch fixes this by
using a dummy MODIFY_EXPR in this situation, whose evaluation ensures
the member gets activated.
PR c++/102163
gcc/cp/ChangeLog:
* constexpr.c (cxx_eval_call_expression): After evaluating a
subobject constructor call for an empty union member, produce a
side effect that makes sure the member gets activated.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/constexpr-empty17.C: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
0 files changed, 0 insertions, 0 deletions