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

2024-10-26


1522. Access checking for initializer_list array initialization

Section: 9.4.5  [dcl.init.list]     Status: CD3     Submitter: John Spicer     Date: 2012-07-12

[Moved to DR at the April, 2013 meeting.]

In constructing an initializer_list object from an initializer list, 9.4.5 [dcl.init.list] paragraph 5 says of the underlying array,

Each element of that array is copy-initialized with the corresponding element of the initializer list

It would probably be good to mention that the copy/move constructor for this copy must be accessible in the context in which the initialization occurs.

Proposed resolution (October, 2012):

Change 9.4.5 [dcl.init.list] paragraph 4 as follows:

...Each element of that array is copy-initialized with the corresponding element of the initializer list, and the std::initializer_list<E> object is constructed to refer to that array. [Note: A constructor or conversion function selected for the copy shall be accessible (11.8 [class.access]) in the context of the initializer list. —end note] If a narrowing conversion is required...