Title
Initializers for empty-class aggregrate members
Status
cd1
Section
9.4.2 [dcl.init.aggr]
Submitter
Nathan Sidwell

Created on 2004-12-15.00:00:00 last changed 188 months ago

Messages

Date: 2007-04-15.00:00:00

[Voted into WP at April, 2007 meeting.]

Date: 2005-10-15.00:00:00

Proposed resolution (October, 2005):

This issue is resolved by the resolution of issue 413.

Date: 2004-12-15.00:00:00

The current wording of 9.4.2 [dcl.init.aggr] paragraph 8 requires that

An initializer for an aggregate member that is an empty class shall have the form of an empty initializer-list {}.

This is overly constraining. There is no reason that the following should be ill-formed:

    struct S { };
    S s;
    S arr[1] = { s };

Mike Miller: The wording of 9.4.2 [dcl.init.aggr] paragraph 8 is unclear. “An aggregate member” would most naturally mean “a member of an aggregate.” In context, however, I think it must mean “a member [of an aggregate] that is an aggregate”, that is, a subaggregate. Members of aggregates need not themselves be aggregates (cf paragraph 13 and 11.9.2 [class.expl.init]); it cannot be the case that an object of an empty class with a user-declared constructor must be initialized with {} when it is a member of an aggregate. This wording should be clarified, regardless of the decision on Nathan's point.

History
Date User Action Args
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2007-08-05 00:00:00adminsetstatus: dr -> wp
2007-05-06 00:00:00adminsetmessages: + msg1502
2007-05-06 00:00:00adminsetstatus: ready -> dr
2006-11-05 00:00:00adminsetstatus: review -> ready
2005-10-22 00:00:00adminsetmessages: + msg1238
2005-10-22 00:00:00adminsetstatus: drafting -> review
2005-05-01 00:00:00adminsetstatus: open -> drafting
2004-12-15 00:00:00admincreate