This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


2551. "Refers to allocated storage" has no meaning

Section: 6.7.3  [basic.life]     Status: review     Submitter: Andrey Erokhin     Date: 2020-09-07

6.7.3 [basic.life] paragraph 6 specifies:

Before the lifetime of an object has started but after the storage which the object will occupy has been allocated or, after the lifetime of an object has ended and before the storage which the object occupied is reused or released, any pointer that represents the address of the storage location where the object will be or was located may be used but only in limited ways. For an object under construction or destruction, see 11.9.5 [class.cdtor]. Otherwise, such a pointer refers to allocated storage (6.7.5.5.2 [basic.stc.dynamic.allocation]), and using the pointer as if the pointer were of type void* is well-defined.

Similarly, 6.7.3 [basic.life] paragraph 7 specifies:

Similarly, before the lifetime of an object has started but after the storage which the object will occupy has been allocated or, after the lifetime of an object has ended and before the storage which the object occupied is reused or released, any glvalue that refers to the original object may be used but only in limited ways. For an object under construction or destruction, see 11.9.5 [class.cdtor]. Otherwise, such a glvalue refers to allocated storage (6.7.5.5.2 [basic.stc.dynamic.allocation]), and using the properties of the glvalue that do not depend on its value is well-defined.

In either case, it is unclear what "refers to allocated storage" means, beyond the properties ascribed to an object in 6.7.2 [intro.object].

See also issue 1853.

Proposed resolution:

  1. Change in 6.7.3 [basic.life] paragraph 6 as follows:

    For an object under construction or destruction, see 11.9.5 [class.cdtor]. Otherwise, such a pointer refers to allocated storage (6.7.5.5.2 [basic.stc.dynamic.allocation]), and using the such a pointer as if the pointer were of type void* is well-defined.
  2. Change in 6.7.3 [basic.life] paragraph 7 as follows:

    For an object under construction or destruction, see 11.9.5 [class.cdtor]. Otherwise, such a glvalue refers to allocated storage (6.7.5.5.2 [basic.stc.dynamic.allocation]), and using the properties of the such a glvalue that do not depend on its value is well-defined.