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

2024-08-20


2842. Preferring an initializer_list over a single value

Section: 12.2.4.3  [over.ics.rank]     Status: open     Submitter: Jason Merrill     Date: 2022-12-10

Consider:

  #include <initializer_list>
  struct A { A(int) {} };
  void f(int) = delete;
  void f(std::initializer_list<A>) {}   // #1
  int main() { f({10}); }

The intent of issue 1467 was to make this example well-formed by choosing #1, according to this rule and a corresponding example in 12.2.4.3 [over.ics.rank] bullet 3.1:

See also issue 2137 and gcc issue 64665.

Possible resolution:

Move 12.2.4.3 [over.ics.rank] paragraph 2 into paragraph 3 as follows:

When comparing the basic forms of implicit conversion sequences (as defined in 12.2.4.2 [over.best.ics])

Two implicit conversion sequences of the same form are indistinguishable conversion sequences unless one of the following rules applies: