-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Full name of submitter: Evan Girardin (he gave me permission to file this issue on his behalf)
Reference (section label): [over.ics.rank], [over.ics.ref]
Issue description: The tiebreaker rules in [over.ics.rank]/4 should apply to the case where one conversion has a reference as its destination type and the other does not. All known implementations agree. Therefore, [over.ics.ref] should be updated to specify the source and destination types for a derived-to-base reference binding.
Suggested resolution: Edit [over.ics.ref]/1:
When a parameter of type "reference to cv T" binds directly ([dcl.init.ref]) to an argument expression:
- If the argument expression has a type that is a derived class of the parameter type, the implicit conversion sequence is a derived-to-base conversion from the class of the parameter type to
T
([over.best.ics]).- Otherwise, if the type of the argument is possibly cv-qualified T, or if T is an array type of unknown bound with element type U and the argument has an array type of known bound whose element type is possibly cv-qualified U, the implicit conversion sequence is the identity conversion.
- Otherwise, if T is a function type, the implicit conversion sequence is a function pointer conversion.
- Otherwise, the implicit conversion sequence is a qualification conversion.
Strike subbullets 2 and 6 from [over.ics.rank]/4.5.
If class
B
is derived directly or indirectly from classA
and classC
is derived directly or indirectly fromB
,
- conversion of
C*
toB*
is better than conversion ofC*
toA*
, [Example: ...]binding of an expression of type C to a reference to type B is better than binding an expression of type C to a reference to type A,- conversion of
A::*
toB::*
is better than conversion ofA::*
toC::*
,- conversion of C to B is better than conversion of C to A,
- conversion of
B*
toA*
is better than conversion ofC*
toA*
,binding of an expression of type B to a reference to type A is better than binding an expression of type C to a reference to type A,- conversion of
B::
* toC::*
is better than conversion ofA::*
toC::*
, and- conversion of B to A is better than conversion of C to A.
[Note: ...]