Created on 2011-11-19.00:00:00 last changed 131 months ago
[Moved to DR at the October, 2012 meeting.]
Proposed resolution (February, 2012):
Change 9.4.5 [dcl.init.list] paragraph 5 as follows:
An object of type std::initializer_list<E> is constructed from an initializer list as if the implementation allocated an array of N elements of type const E, where N is the number of elements in the initializer list. 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. If a narrowing conversion is required to initialize any 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 equivalent to 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_list object with a pair of pointers. —end example]
According to 9.4.5 [dcl.init.list] paragraph 5, the elements of the backing array for an object of type std::initializer_list<E> are of type E. This is contradicted by the wording of 17.10 [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 |