c++: constexpr and designated initializer
commit22cda0ca5fb406f22925bbf51ab152a958e3319d
authorJason Merrill <jason@redhat.com>
Fri, 22 Sep 2023 09:54:28 +0000 (22 10:54 +0100)
committerJason Merrill <jason@redhat.com>
Fri, 22 Sep 2023 13:22:26 +0000 (22 14:22 +0100)
tree6e35d8cdb169e584e492e54ef7026d3198f71172
parent9c62af101e11e1cce573c2b3d2e18b403412dbc8
c++: constexpr and designated initializer

The change of active member being non-constant (before C++20) results in a
CONSTRUCTOR with a null value for the first field, don't crash.

gcc/cp/ChangeLog:

* constexpr.cc (free_constructor): Handle null ce->value.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-union7.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/cpp2a/constexpr-union7.C [new file with mode: 0644]