Created on 2005-03-19.00:00:00 last changed 160 months ago
Rationale (August, 2011):
As given in the preceding note.
Note (March, 2008):
This issue was resolved by the adoption of paper J16/08-0054 = WG21 N2544 (“Unrestricted Unions”) at the Bellevue meeting.
Can a member of a union be of a class that has a user-declared non-default constructor? The restrictions on union membership in 11.5 [class.union] paragraph 1 only mention default and copy constructors:
An object of a class with a non-trivial default constructor (11.4.5 [class.ctor]), a non-trivial copy constructor (11.4.5.3 [class.copy.ctor]), a non-trivial destructor (11.4.7 [class.dtor]), or a non-trivial copy assignment operator (12.4.3.2 [over.ass], 11.4.5.3 [class.copy.ctor]) cannot be a member of a union...
(11.4.5 [class.ctor] paragraph 11 does say, “a non-trivial constructor,” but it's not clear whether that was intended to refer only to default and copy constructors or to any user-declared constructor. For example, 6.7.7 [class.temporary] paragraph 3 also speaks of a “non-trivial constructor,” but the cross-references there make it clear that only default and copy constructors are in view.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-09-06 00:00:00 | admin | set | messages: + msg3579 |
2011-09-06 00:00:00 | admin | set | status: review -> nad |
2008-03-17 00:00:00 | admin | set | messages: + msg1602 |
2008-03-17 00:00:00 | admin | set | status: open -> review |
2005-03-19 00:00:00 | admin | create |