Title
Qualification conversion vs difference in reference binding
Status
cd3
Section
12.2.4.3 [over.ics.rank]
Submitter
Michael Wong

Created on 2011-08-15.00:00:00 last changed 131 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-02-15.00:00:00

Proposed resolution (February, 2012):

Move 12.2.4.3 [over.ics.rank] paragraph 3, first bullet, third sub-bullet, after the current fifth sub-bullet, as follows:

Two implicit conversion sequences of the same form are indistinguishable conversion sequences unless one of the following rules applies:

  • Standard conversion sequence S1 is a better conversion sequence...

    • S1 is a proper subsequence of S2...

    • the rank of S1 is better...

    • S1 and S2 differ only in their qualification conversion... —end example] or if not that,

    • S1 and S2 are reference bindings (9.4.4 [dcl.init.ref]) and neither refers... or if not that,

    • S1 and S2 are reference bindings (9.4.4 [dcl.init.ref]) and S1 binds... —end example] or if not that,

    • S1 and S2 differ only in their qualification conversion... —end example] or if not that,

    • S1 and S2 are reference bindings (9.4.4 [dcl.init.ref]), and the types to which the references refer...

  • User-defined conversion sequence U1...
Date: 2012-02-15.00:00:00

Notes from the February, 2012 meeting:

The CWG agreed that bullets 3 and 4 should be reversed, to check the reference binding first and then for qualification conversion.

Date: 2011-08-15.00:00:00

The rule in 12.2.4.3 [over.ics.rank] paragraph 3 for ranking based on a difference in qualification conversion applies only if they "differ only in their qualification conversion".

It is unclear as to whether the property of being a reference binding is a factor in determining if there is a difference between conversion sequences. Notice that 12.2.4.2.5 [over.ics.ref] maps reference bindings to other forms of implicit conversion sequences, but does not state that the property of being a reference binding is preserved; however, 12.2.4.3 [over.ics.rank] has cases which depend on whether certain standard conversion sequences are reference bindings or not and on the specifics of the bindings.

In the following, picking T2 && would bind an rvalue to an rvalue reference. Picking T1 & would bind an rvalue to an lvalue reference, but the qualification conversion to T1 is "better". Which is better?

    typedef int *      *      *const *const T1;
    typedef int *const *const *const *const T2;
    void foo(T1 &);
    void foo(T2 &&) { }

    int main() {
       foo((int ****)0);
       return 0;
    }
History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4420
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetstatus: review -> ready
2012-02-27 00:00:00adminsetmessages: + msg3761
2012-02-27 00:00:00adminsetmessages: + msg3760
2012-02-27 00:00:00adminsetstatus: open -> review
2011-08-15 00:00:00admincreate