Created on 2012-06-06.00:00:00 last changed 122 months ago
[Moved to DR at the September, 2013 meeting.]
Proposed resolution (June, 2013):
Change the note in 9.4.5 [dcl.init.list] paragraph 2 as follows:
[Note: Initializer-list constructors are favored over other constructors in list-initialization (12.2.2.8 [over.match.list]). Passing an initializer list as the argument to the constructor template template<class T> C(T) of a class C does not create an initializer-list constructor, because an initializer list argument causes the corresponding parameter to be a non-deduced context (13.10.3.2 [temp.deduct.call]). —end note]
Additional note (January, 2013):
The wording of the new note needs to be adjusted, because such a constructor template might have a default template argument that is a specialization of std::initializer_list. For example:
struct D { template<typename T = std::initializer_list<int>> D(T); }; D d{{1, 2, 3}};
Proposed resolution (October, 2012) [superseded]:
Modify 9.4.5 [dcl.init.list] paragraph 2 as follows:
A constructor is an initializer-list constructor if its first parameter is of type std::initializer_list<E> or reference to possibly cv-qualified std::initializer_list<E> for some type E, and either there are no other parameters or else all other parameters have default arguments (9.3.4.7 [dcl.fct.default]). [Note: Initializer-list constructors are favored over other constructors in list-initialization (12.2.2.8 [over.match.list]). Given a class C, a constructor template such as template<class T> C(T) is never instantiated to produce an initializer-list constructor, because an initializer list argument causes the corresponding parameter to be a non-deduced context (13.10.3.2 [temp.deduct.call]). —end note] The template std::initializer_list is not predefined;...
Can a constructor template ever be an initializer-list constructor without std::initializer_list (or an alias template specialization for it) appearing in the template signature? E.g., is there any way that the constructor in:
struct S { template<typename T> S(T); };
can be an initializer-list constructor?
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-11-24 00:00:00 | admin | set | status: drwp -> c++14 |
2014-03-03 00:00:00 | admin | set | status: dr -> drwp |
2013-10-14 00:00:00 | admin | set | messages: + msg4690 |
2013-10-14 00:00:00 | admin | set | status: tentatively ready -> dr |
2013-09-03 00:00:00 | admin | set | messages: + msg4459 |
2013-09-03 00:00:00 | admin | set | status: drafting -> tentatively ready |
2013-05-03 00:00:00 | admin | set | status: review -> drafting |
2013-01-14 00:00:00 | admin | set | messages: + msg4202 |
2013-01-14 00:00:00 | admin | set | status: tentatively ready -> review |
2012-11-03 00:00:00 | admin | set | messages: + msg4075 |
2012-11-03 00:00:00 | admin | set | status: open -> tentatively ready |
2012-06-06 00:00:00 | admin | create |