Created on2011-11-19.00:00:00 last changed145 months ago
[Moved to DR at the October, 2012 meeting.]
Proposed resolution (February, 2012):
Change 9.5.5 [dcl.init.list] paragraph 5 as follows:
An object of typestd::initializer_list<E> isconstructed from an initializer list as if the implementationallocated an array ofN elements of typeconstE, whereN is the number of elements in the initializerlist. Each element of that array is copy-initialized with thecorresponding element of the initializer list, and thestd::initializer_list<E> object is constructed to referto that array. If a narrowing conversion is required to initializeany of the elements, the program is ill-formed. [Example:
struct X { X(std::initializer_list<double> v); }; X x{ 1,2,3 };The initialization will be implemented in a way roughly equivalentto this:
const double __a[3] = {double{1}, double{2}, double{3}}; X x(std::initializer_list<double>(__a, __a+3));assuming that the implementation can construct an initializer_listobject with a pair of pointers. —end example]
According to 9.5.5 [dcl.init.list] paragraph 5, theelements of the backing array for an object of typestd::initializer_list<E> are of typeE. This is contradicted by the wording of17.11 [support.initlist] paragraph 2.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
| 2013-05-03 00:00:00 | admin | set | status: dr -> drwp |
| 2012-11-03 00:00:00 | admin | set | messages: +msg4149 |
| 2012-11-03 00:00:00 | admin | set | status: ready -> dr |
| 2012-02-27 00:00:00 | admin | set | messages: +msg3724 |
| 2012-02-27 00:00:00 | admin | set | status: open -> ready |
| 2011-11-19 00:00:00 | admin | create | |