This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
[Voted into the WP at the March, 2011 meeting as part of paper N3262.]
N3092 comment US 66Overload resolution should first look for a viable list constructor, then look for a non-list constructor if no list constructor is viable.
Proposed resolution (August, 2010) [SUPERSEDED]:
Change 9.4.5 [dcl.init.list] bullet 3.5 as follows:
Otherwise, if T is a class type,
constructors are considered. If T has an
initializer-list constructor, the argument list consists of
the initializer list as a single argument; otherwise, the
argument list consists of the elements of the initializer
list. The applicable constructors are enumerated
(12.2.2.8 [over.match.list]) and the best one
is chosen through overload resolution (12.2.2.8 [over.match.list], 12.2 [over.match]). If a
narrowing conversion (see below) is required to convert any
of the arguments, the program is ill-formed.
[Example:...
Change 12.2.2.8 [over.match.list] as follows:
When objects of non-aggregate class type T are list-initialized (9.4.5 [dcl.init.list]), overload resolution selects the constructor in two phases
as follows, where T is the cv-unqualified class type of the object being initialized:
If T has an initializer-list constructor (9.4.5 [dcl.init.list]),Initially, the candidate functions are the initializer-list constructors (9.4.5 [dcl.init.list]) of the class T and the argument list consists of the initializer list as a single argument.
; otherwise,If no viable initializer-list constructor is found, overload resolution is performed again, where the candidate functions are all the constructors of the class T and the argument list consists of the elements of the initializer list.
For direct-list-initialization, the candidate functions are all the constructors of the class T.
ForIn copy-list-initialization,the candidate functions are all the constructors of T. However,if an explicit constructor is chosen, the initialization is ill-formed. [Note: This differs from other situations (12.2.2.4 [over.match.ctor], 12.2.2.5 [over.match.copy]), where only converting constructors are considered for copy-initialization. This restriction only applies if this initialization is part of the final result of overload resolution. —end note]