c++: constexpr, empty base after non-empty [PR106369]
authorJason Merrill <jason@redhat.com>
Tue, 26 Jul 2022 15:02:21 +0000 (11:02 -0400)
committerJason Merrill <jason@redhat.com>
Sun, 31 Jul 2022 02:56:36 +0000 (19:56 -0700)
commit9efe4e153d994974afcbba09c3c683f5f4a19c63
treefb0fb733b166e3c5c6215b2366dc0fc3c63827b8
parent9ef2c9aa5b351efa9b751de4f10180427cd0fe70
c++: constexpr, empty base after non-empty [PR106369]

Here the CONSTRUCTOR we were providing for D{} had an entry for the B base
subobject at offset 0 following the entry for the C base, causing
output_constructor_regular_field to ICE due to going backwards.  It might be
nice for that function to be more tolerant of empty fields, but it also
seems reasonable for the front end to prune the useless entry.

PR c++/106369

gcc/cp/ChangeLog:

* constexpr.cc (reduced_constant_expression_p): Return false
if a CONSTRUCTOR initializes an empty field.

gcc/testsuite/ChangeLog:

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