https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93916

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to andysem from comment #4)
> Are you saying that implementation is allowed to not preserve unused storage
> state upon construction and assignment? Because I don't think this is what
> the standard says.

I disagree. It doesn't say the values of padding bits are preserved after
constructing an object in that storage.

> Is there any other way to achieve the effect of initializing padding in a
> struct?

The standard requires zero-initialization to clear all padding bits. Other
forms of initialization (including copy-initialization as in your example) do
not specify the effect on padding bits.

Reply via email to