Ambiguous ranking of list-initialization sequences
Section [over.ics.rank]
Johannes Schaub

Created on 2012-11-21.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-04-15.00:00:00

Notes from the April, 2013 meeting:

CWG determined that the latter bullet should apply only if the first one does not.

Date: 2012-11-21.00:00:00

The interpretation of the following example is unclear in the current wording:

   void f(long);
   void f(initializer_list<int>);
   int main() { f({1L});

The problem is that a list-initialization sequence can also be a standard conversion sequence, depending on the types of the elements and the type of the parameter, so more than one bullet in the list in [over.ics.rank] paragraph 3 applies:

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

  • Standard conversion sequence S1 is a better conversion sequence than standard conversion sequence S2 if

    • ...

    • the rank of S1 is better than the rank of S2, or S1 and S2 have the same rank and are distinguishable by the rules in the paragraph below, or, if not that,

    • ...

  • ...

  • List-initialization sequence L1 is a better conversion sequence than list-initialization sequence L2 if L1 converts to std::initializer_list<X> for some X and L2 does not.

These bullets give opposite results for the example above, and there is implementation variance in which is selected.

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: + msg5406
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-07-07 00:00:00adminsetstatus: drafting -> ready
2014-03-03 00:00:00adminsetmessages: + msg4892
2013-05-03 00:00:00adminsetmessages: + msg4346
2013-05-03 00:00:00adminsetstatus: open -> drafting
2012-11-21 00:00:00admincreate