Created on 2010-08-03.00:00:00 last changed 131 months ago
[Voted into the WP at the March, 2011 meeting as part of paper N3262.]
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]
Overload resolution should first look for a viable list constructor, then look for a non-list constructor if no list constructor is viable.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | messages: + msg3373 |
2011-04-10 00:00:00 | admin | set | status: ready -> fdis |
2010-11-29 00:00:00 | admin | set | status: review -> ready |
2010-08-23 00:00:00 | admin | set | messages: + msg2831 |
2010-08-03 00:00:00 | admin | create |