This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-09-28
(Split off from issue 3001.)
The out-of-lifetime rules mishandle this example:
int a;
int *p = &a;
*p = 1; // #1
new (p) int;
This code has undefined behavior because, according to the wording specifying "represents the address", p is used to access the pointed-to object at #1 before its lifetime starts in the following line.
Suggested resolution:
Change in 6.8.4 [basic.life] paragraph 7 as follows:
Before the lifetime of an object has started but after the storage which the object will occupy has been allocated [ Footnote: ...] or, after the lifetime of an object has ended and before the storage which the object occupied is reused or released, any pointer thatrepresents the address of the storage location where the object will be or was locatedpoints to the object may be used but only in limited ways. ...