Created on 2014-02-12.00:00:00 last changed 95 months ago
[Moved to DR at the November, 2014 meeting.]
Proposed Resolution (July, 2014):
Change 14.3 [except.ctor] paragraph 2 as follows:
An object of any storage duration whose initialization or destruction is terminated by an exception will have destructors executed for all of its fully constructed subobjects(excluding the variant members of a union-like class), that is, for subobjects for which the principal constructor (11.9.3 [class.base.init]) has completed execution and the destructor has not yet begun execution, except that in the case of destruction, the variant members of a union-like class are not destroyed. Similarly, if the non-delegating constructor...
Notes from the June, 2014 meeting:
CWG favored removing the exclusion of variant members from the destruction following an exception during construction, though not during destruction. If the active member of the union has changed between the initialization and destruction, the behavior is undefined.
According to 14.3 [except.ctor] paragraph 2,
An object of any storage duration whose initialization or destruction is terminated by an exception will have destructors executed for all of its fully constructed subobjects (excluding the variant members of a union-like class), that is, for subobjects for which the principal constructor (11.9.3 [class.base.init]) has completed execution and the destructor has not yet begun execution.
This introduces a potential leak if a variant member is initialized and has a non-trivial destructor. If the assumption can't be made that such an initialized member is the active member at the time an exception occurs so that it can be destroyed, perhaps variant members of types having a non-trivial destructor should be prohibited.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
2015-04-13 00:00:00 | admin | set | messages: + msg5422 |
2014-11-24 00:00:00 | admin | set | status: tentatively ready -> dr |
2014-10-13 00:00:00 | admin | set | messages: + msg5145 |
2014-10-13 00:00:00 | admin | set | status: drafting -> tentatively ready |
2014-07-07 00:00:00 | admin | set | messages: + msg5099 |
2014-07-07 00:00:00 | admin | set | status: open -> drafting |
2014-02-12 00:00:00 | admin | create |