Created on 2025-06-18.00:00:00 last changed 1 month ago
(From submission #717.)
Calling a non-static member function for an ou8t-of-lifetime object is undefined behavior according to 6.7.4 [basic.life] paragraph 7 and paragraph 8. There is no reason to normatively duplicate that general rule for a subset of destructors in 6.7.4 [basic.life] paragraph 11.
Possible resolution:
Change in 6.7.4 [basic.life] paragraph 11 as follows:
[Note: If a program ends the lifetime of an object of type Twith static (6.7.6.2 [basic.stc.static]), thread (6.7.6.3 [basic.stc.thread]), or automatic (6.7.6.4 [basic.stc.auto]) storage duration and if T has a non-trivial destructorfor which the destructor will be called implicitly (8.9 [stmt.dcl], 6.9.3.4 [basic.start.term]), and another object of the original type does not occupy that same storage location when the implicit destructor call takes place, the behavior of the program is undefined.This is true even if the block is exited with an exception.[Example 4: ... —end example] -- end note]
History | |||
---|---|---|---|
Date | User | Action | Args |
2025-06-18 00:00:00 | admin | create |