I'm on my phone and Godbolt is awful here so I can't test, but the problem is likely that your class is POD.
As with everything in c++, terms and conditions may apply.
So if you make members private it will probably fix it, if I'm not mistaken.
Might want to checkout

 https://stackoverflow.com/questions/25226347/gcc-clang-lay-out-fields-of-a-derived-struct-in-the-back-padding-of-base-struct/51334730#51334730


Em dom., 3 de dez. de 2023 19:57, Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> escreveu:

Hi Breno,

I can see the padding of base classes being used (without attribute) only for empty base classes.

See

https://godbolt.org/z/bnnohMGTv

 

What am I missing?

Best,

Sebastian
 

-----Ursprüngliche Nachricht-----
Von: Breno Guimarães via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: So 03.12.2023 23:17
Betreff: Re: [std-proposals] std::sizeof_minus_trailing_padding
An: Std-Proposals <std-proposals@lists.isocpp.org>;
CC: Breno Guimarães <brenorg@gmail.com>;
Yeah, the link only talks about empty base class optimization, but that happens with non empty too. It should've been called "padding optimization" or something.
 
Just derive a class with trailing padding and add a member that can fit in the padding and the padding will be reused.

Em dom., 3 de dez. de 2023 18:48, Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org> escreveu:
On Sun, Dec 3, 2023 at 7:20 PM Breno Guimarãeswrote:
>
> By the way, the no_unique_address annotation didn't bring the concept of overlapping objects. It already existed.
>
> https://en.cppreference.com/w/cpp/language/ebo


But people haven't been memcpy'ing and memset'ing empty base classes
for a few decades.

Bringing it in for types where people would have historically been
using 'memset' as a bulldozer for a few decades is a much bigger deal.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
 
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals