This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 110b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2023-01-15


1151. Overload resolution with initializer-list and non-list constructors

Section: 12.2.2.8  [over.match.list]     Status: C++11     Submitter: US     Date: 2010-08-03

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

N3092 comment US 66

Overload 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]:

  1. Change 9.4.5 [dcl.init.list] bullet 3.5 as follows:

  2. Change 12.2.2.8 [over.match.list] as follows:

  3. 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:

    For In 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]