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

2024-09-25


2077. Overload resolution and invalid rvalue-reference initialization

Section: 12.2.4.2.5  [over.ics.ref]     Status: drafting     Submitter: Richard Smith     Date: 2015-01-29

The resolution of issue 1604 broke the following example:

  struct A {};
  struct B { operator const A() const; };
  void f(A const&);
  void f(A&&);

  int main() {
    B a;
    f(a);
  }

Overload resolution selects the A&& overload, but then initialization fails. This seems like a major regression; we're now required to reject

   std::vector<A> va;
   B b;
   va.push_back(b);

Should we update 12.2.4.2.5 [over.ics.ref] to match the changes made to 9.4.4 [dcl.init.ref]?

See also issue 2108.