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

2024-03-20


702. Preferring conversion to std::initializer_list

Section: 12.2.4.3  [over.ics.rank]     Status: CD2     Submitter: Jason Merrill     Date: 2 July, 2008

[Voted into WP at July, 2009 meeting.]

We need another bullet in 12.2.4.3 [over.ics.rank], along the lines of:

This is necessary to make the following example work:

    #include <initializer_list>

    struct string {
      string (const char *) {}
      template <class Iter> string (Iter, Iter);
    };

    template <class T, class U>
    struct pair {
      pair (T t, U u) {}
    };

    template<class T, class U>
    struct map {
      void insert (pair<T,U>);
      void insert (std::initializer_list<pair<T,U> >) {}
    };

    int main() {
      map<string,string> m;
      m.insert({ {"this","that"}, {"me","you"} });
    }

Proposed resolution (March, 2009):

Add a new top-level bullet at the end of the current list in 12.2.4.3 [over.ics.rank] paragraph 3: