This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


1624. Destruction of union members with member initializers

Section: 14.3  [except.ctor]     Status: NAD     Submitter: Vinny Romano     Date: 2013-02-15

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)...

The restriction for variant members does not appear to be necessary when there is a mem-initializer or non-static data member initializer for a union member, as that determines which union member is active during the execution of the constructor.

Rationale (April, 2013):

Although the active member in a member union is determined by an initializer, it could change during the execution of the constructor's compound=statement.