Created on 2024-08-05.00:00:00 last changed 6 days ago
CWG 2024-09-27
Also allow for constant destruction, consider arrays of class type, and adjust the happens-before requirements.
Possible resolution:
Change in 6.9.3.4 [basic.start.term] paragraph 1 as follows:
Constructed complete objects (9.4 [dcl.init]) with static storage duration and not having constant destruction (7.7 [expr.const]) are destroyed and functions registered with std::atexit are called as part of a call to std::exit (17.5 [support.start.term]). The call to std::exit is sequenced before the destructions and the registered functions.
Change in 6.9.3.4 [basic.start.term] paragraph 2 as follows:
Constructed complete objects with thread storage duration within a given thread and not having constant destruction (7.7 [expr.const]) are destroyed as a result of returning from the initial function of that thread and as a result of that thread calling std::exit. The destruction ofallthose constructed objectswith thread storage durationwithin that thread strongly happens before releasing the storage for all objects with thread storage duration within that thread (6.7.5.3 [basic.stc.thread]). Also, the destruction of those constructed objects within that thread strongly happens before destroying any object with static storage duration.
Issue 2256 (adopted in February, 2019) changed the rules such that the lifetimes of objects do not depend on whether the destructor is trivial or not. However, the motivation of that issue mentioned only objects with automatic storage duration. To be able to avoid order-of-destruction issues across translation units, it would be useful to never end the lifetime of trivially-destructible objects with static storage duration and to delay the end of the lifetime of such objects with thread storage duration as long as possible.
Possible resolution [SUPERSEDED]:
Change in 6.9.3.4 [basic.start.term] paragraph 1 as follows:
Constructed class objects (9.4 [dcl.init]) with static storage duration and having a non-trivial destructor (11.4.7 [class.dtor]) are destroyed and functions registered with std::atexit are called as part of a call to std::exit (17.5 [support.start.term]). The call to std::exit is sequenced before the destructions and the registered functions.
Change in 6.9.3.4 [basic.start.term] paragraph 2 as follows:
Constructed class objects with thread storage duration within a given thread and having a non-trivial destructor (11.4.7 [class.dtor]) are destroyed as a result of returning from the initial function of that thread and as a result of that thread calling std::exit. The destruction ofallthose constructed objects with thread storage duration within that thread strongly happens before releasing the storage for objects with thread storage duration within that thread, which in turn strongly happens before destroying any object with static storage duration.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-09-27 21:20:46 | admin | set | messages: + msg7827 |
2024-09-27 21:20:46 | admin | set | status: open -> review |
2024-08-05 00:00:00 | admin | create |