Title
Overload resolution for base class conversion and reference/non-reference
Status
drafting
Section
12.2.4.3 [over.ics.rank]
Submitter
Alexander Kulpin

Created on 2015-03-27.00:00:00 last changed 117 months ago

Messages

Date: 2015-03-27.00:00:00

There are overload tiebreakers that order reference/nonreference and base/derived conversions, but how they relate is not specified. For example:

  struct A { A(); };
  struct B : A {};
  struct C : B {};

  void f1(B&);
  void f1(A);

  void f2(B);
  void f2(A&);

  int main()
  {
     C v;
     f1(v); // all compilers choose f1(B&)
     f2(v); // all compilers choose f2(B)
  }

The Standard does not appear to specify what happens in this case.

History
Date User Action Args
2015-03-27 00:00:00admincreate