[C++ PATCH] c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
Jason Merrill
jason@redhat.com
Tue Dec 3 07:07:00 GMT 2019
On 12/2/19 5:09 PM, Marek Polacek wrote:
> On Mon, Dec 02, 2019 at 12:09:17PM -0500, Jason Merrill wrote:
>> On 12/1/19 8:09 PM, Marek Polacek wrote:
>>> + || (skip_empty
>>> + && is_really_empty_class (TREE_TYPE (field),
>>
>> This should probably check DECL_SIZE (field) == size_zero_node instead,
>> since that will properly distinguish between overlapping and non-overlapping
>> data members of empty class type. And please test how this works with data
>> members of empty class type both with and without [[no_unique_address]].
>
> I don't think that's possible -- empty classes in C++ have sizeof(char), unless
> their only member is char[0], then their DECL_SIZE is 0.
I think you're talking about the TYPE_SIZE of the class, and I'm talking
about the DECL_SIZE of the FIELD_DECL.
> I've added two testcases: constexpr-init13.C and constexpr-init14.C. Is there
> another scenario regarding [[no_unique_address]] that you want me to test?
I think the classes with empty base fields need to have another
initialized field after them to have a chance of tripping
if (idx != field)
Jason
More information about the Gcc-patches
mailing list