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

2024-12-19


2028. Converting constructors in rvalue reference initialization

Section: 12.2.2.7  [over.match.ref]     Status: drafting     Submitter: Mitsuru Kariya     Date: 2014-10-25

Consider the following example:

  struct T {
    T() {}
    T(struct S&) {}
  };

  struct S {
    operator T() { return T(); }
  };

  int main()
  {
    S s;
    T&& t(s);  // #1
  }

Because there are two possible conversions from S to T, one by conversion function and the other by converting constructor, one might expect that the initialization at #1 would be ambiguous. However, 12.2.2.7 [over.match.ref] (used in the relevant bullet of 9.4.4 [dcl.init.ref], paragraph 5.2.1.2) only deals with conversion functions and ignores converting constructors.

Notes from the November, 2014 meeting:

CWG agreed that 9.4.4 [dcl.init.ref] should be changed to consider converting constructors in this case.