Created on 2005-10-27.00:00:00 last changed 178 months ago
[Voted into the WP at the March, 2009 meeting.]
Proposed resolution (October, 2006):
Change 11.9 [class.init] paragraph 3 as follows:
When an array of class objects is initialized (either explicitly or implicitly) and the elements are initialized by constructor, the constructor shall be called for each element of the array, following the subscript order; see 9.3.4.5 [dcl.array].
11.9 [class.init] paragraph 2 says,
When an array of class objects is initialized (either explicitly or implicitly), the constructor shall be called for each element of the array, following the subscript order;
That implies that, given
struct POD { int x; }; POD data[10] = {};
this should call the implicitly declared default ctor 10 times, leaving 10 uninitialized ints, rather than value initialize each member of data, resulting in 10 initialized ints (which is required by 9.4.2 [dcl.init.aggr] paragraph 7).
I suggest rephrasing along the lines:
When an array is initialized (either explicitly or implicitly), each element of the array shall be initialized in turn, following the subscript order;
This would allow for PODs and other classes with a dual nature under value/default initialization, and cover copy initialization for arrays too.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: wp -> cd2 |
2009-08-03 00:00:00 | admin | set | status: dr -> wp |
2009-03-23 00:00:00 | admin | set | messages: + msg2028 |
2009-03-23 00:00:00 | admin | set | status: ready -> dr |
2008-10-05 00:00:00 | admin | set | status: review -> ready |
2006-11-05 00:00:00 | admin | set | messages: + msg1407 |
2006-11-05 00:00:00 | admin | set | status: drafting -> review |
2006-04-22 00:00:00 | admin | set | status: open -> drafting |
2005-10-27 00:00:00 | admin | create |