Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [class.copy.ctor], [class.copy.assign]
Link to reflector thread (if any):
Issue description:
It's specified in [class.copy.ctor] p15 and [class.copy.assign] p13 that a trivial and elegible copy or move function of a union copies the object representation, which can be problematic when the union object is a potentially-overlapping member subobject, and another subobject of the complete object overlaps with its tail padding, because the latter will be unintentionally overwritten.
Suggested resolution:
Change [class.copy.ctor] p15 as indicated:
The implicitly-defined copy/move constructor for a union X copies the object value representation ([basic.types.general]) of X. [...]
Change [class.copy.assign] p13 as indicated:
The implicitly-defined copy/move assignment operator for a union X copies the object value representation ([basic.types.general]) of X. [...]
Full name of submitter (unless configured in github; will be published with the issue): Jiang An
Reference (section label): [class.copy.ctor], [class.copy.assign]
Link to reflector thread (if any):
Issue description:
It's specified in [class.copy.ctor] p15 and [class.copy.assign] p13 that a trivial and elegible copy or move function of a union copies the object representation, which can be problematic when the union object is a potentially-overlapping member subobject, and another subobject of the complete object overlaps with its tail padding, because the latter will be unintentionally overwritten.
Suggested resolution:
Change [class.copy.ctor] p15 as indicated:
Change [class.copy.assign] p13 as indicated: