Created on2014-02-12.00:00:00 last changed109 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 ordestruction is terminated by an exception will havedestructors executed for all of its fully constructedsubobjects(excluding the variant members of aunion-like class), that is, for subobjects for whichthe principal constructor (11.9.3 [class.base.init]) hascompleted execution and the destructor has not yet begunexecution, except that in the case of destruction, thevariant members of a union-like class are notdestroyed. Similarly, if the non-delegatingconstructor...
Notes from the June, 2014 meeting:
CWG favored removing the exclusion of variant members from thedestruction following an exception during construction, though notduring destruction. If the active member of the union has changedbetween 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 isterminated by an exception will have destructors executed for all of itsfully constructed subobjects (excluding the variant members of a union-likeclass), that is, for subobjects for which the principal constructor(11.9.3 [class.base.init]) has completed execution and the destructorhas not yet begun execution.
This introduces a potential leak if a variant member is initialized andhas a non-trivial destructor. If the assumption can't be made that such aninitialized member is the active member at the time an exception occurs sothat it can be destroyed, perhaps variant members of types having anon-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 | |