- Title
- Delegating constructors, destructors, and std::exit
- Status
- cd2
- Section
- 6.10.3.3 [basic.start.dynamic]
- Submitter
- Michael Wong
Created on 2009-02-12.00:00:00 last changed 199 months ago
Messages
Date: 2009-10-15.00:00:00
[Voted into WP at October, 2009 meeting.]
Date: 2009-07-15.00:00:00
Proposed resolution (July, 2009): Change 6.10.3.3 [basic.start.dynamic] paragraph 1 as follows:
Destructors (11.4.7 [class.dtor]) for initialized objects
(that is, objects whose lifetime (6.8.4 [basic.life]) has
begun) with static storage duration are called as a result of
returning from main and as a result of calling std::exit
(17.5 [support.start.term]). Destructors for initialized objects with
thread storage duration...
Date: 2009-07-15.00:00:00
Notes from the July, 2009 meeting: The CWG decided that the direction adopted at the March, 2009
meeting was incorrect. Instead, the model should be the way
completely-constructed base and member subobjects are handled:
their destructors are called when an exception is thrown but not
when std::exit is called.
Date: 2009-03-15.00:00:00
Notes from the March, 2009 meeting: The CWG agreed that the destructor for a complete object should
be called by std::exit if its non-delegating constructor
has finished, just as for an exception.
Date: 2026-07-25.21:52:10
According to 6.10.3.3 [basic.start.dynamic] paragraph 1, It is unclear, in the presence of delegating constructors, exactly
what an “initialized object” is. 6.8.4 [basic.life] paragraph 1
says that the lifetime of an object does not begin until
it is completely initialized, i.e., when its principal constructor
finishes execution. 14.3 [except.ctor] paragraph 2 says that an
exception during the construction of class object only invokes
destructors for fully-constructed base and member sub-objects (those
for which the principal constructor has completed). On the other hand,
the destructor for a complete class object is called if its
non-delegating constructor has completed, even if the principal
constructor has not yet finished. Which of these models is appropriate
for the behavior of std::exit ?
Destructors (11.4.7 [class.dtor]) for initialized objects with
static storage duration are called as a result of returning from
main and as a result of calling std::exit
(17.5 [support.start.term]).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2010-03-29 00:00:00 | admin | set | status: dr -> cd2 |
| 2009-11-08 00:00:00 | admin | set | messages: + msg2426 |
| 2009-11-08 00:00:00 | admin | set | status: ready -> dr |
| 2009-08-03 00:00:00 | admin | set | messages: + msg2141 |
| 2009-08-03 00:00:00 | admin | set | messages: + msg2140 |
| 2009-08-03 00:00:00 | admin | set | status: drafting -> ready |
| 2009-03-23 00:00:00 | admin | set | messages: + msg1943 |
| 2009-02-12 00:00:00 | admin | create | |