Incorrect overload resolution for single-element initializer-list
Section [over.ics.list]
Johannes Schaub

Created on 2013-03-03.00:00:00 last changed 49 months ago


Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-06-15.00:00:00

Proposed resolution (June, 2014):

This issue is resolved by the resolution of issue 1467.

Date: 2013-03-03.00:00:00

According to bullet 1 of [over.ics.list] paragraph 6,

Otherwise, if the parameter type is not a class:

  • if the initializer list has one element, the implicit conversion sequence is the one required to convert the element to the parameter type;

  • ...

This wording ignores the possibility that the element might be an initializer list (as opposed to an expression with a type, as illustrated in the example). This oversight affects an example like:

  struct A { int a[1]; };
  struct B { B(int); };
  void f(B, int);
  void f(int, A);

  int main() {
    f({0}, {{1}});
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5405
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-07-07 00:00:00adminsetstatus: drafting -> ready
2014-03-03 00:00:00adminsetmessages: + msg4891
2013-05-03 00:00:00adminsetstatus: open -> drafting
2013-03-03 00:00:00admincreate