On 7/31/20 6:06 AM, Jakub Jelinek wrote:
On Fri, Jul 31, 2020 at 10:54:46AM +0100, Jonathan Wakely wrote:
Does the standard require that somewhere?  Because that is not what the
compiler implements right now.

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

But does that imply that all CONSTRUCTORs without CONSTRUCTOR_NO_CLEARING
need to be treated that way?  I mean, aren't such CONSTRUCTORs used also for
other initializations?

Yes, they are also used to represent constant values of classes that are initialized by constexpr constructor.

And, are the default copy constructors or assignment operators supposed to
also copy the padding bits, or do they become unspecified again through
that?

For a non-union class, a defaulted copy is defined as memberwise copy, not a copy of the entire object representation. So I guess strictly speaking the padding bits do become unspecified. But I think if the copy is trivial, in practice all implementations do copy the object representation; perhaps the specification should adjust accordingly.

Jason

Reply via email to