Created on 2022-12-06.00:00:00 last changed 23 months ago
CWG 2023-01-06
Issues 2676 and 2677 were split off from this issue.
Subclause 6.7.2 [intro.object] paragraph 2 specifies that "the created object is a subobject of [the original] containing object" for the example above. This issue is therefore NAD.
Subclause 6.7.4 [basic.life] bullet 8.5 says that o1 is only transparently replaceable by o2 if
either o1 and o2 are both complete objects, or o1 and o2 are direct subobjects of objects p1 and p2, respectively, and p1 is transparently replaceable by p2.
This disallows most of the intended uses of the transparent replacement rule, including example 3 in 11.5.1 [class.union.general], which is similar to:
union A { int n; string s; }; A a; // Does not transparently replace A::s subobject, because // the created object is a complete object. new (&a.s) string("hello"); string t = a.s;
The rule was changed in response to NB comment US 041 (C++20 CD) in what appears to be an over-reach: US 041 says that a member subobject should not transparently replace an unrelated member subobject, but is silent about complete objects transparently replacing members.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-01-07 20:23:15 | admin | set | status: open -> nad |
2022-12-06 22:03:41 | admin | set | messages: + msg7093 |
2022-12-06 00:00:00 | admin | create |