Title
Overload resolution and invalid rvalue-reference initialization
Status
drafting
Section
12.2.4.2.5 [over.ics.ref]
Submitter
Richard Smith

Created on 2015-01-29.00:00:00 last changed 95 months ago

Messages

Date: 2015-01-29.00:00:00

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.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: open -> drafting
2015-01-29 00:00:00admincreate