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

2024-11-11


99. Partial ordering, references and cv-qualifiers

Section: 13.10.3.2  [temp.deduct.call]     Status: NAD     Submitter: Mike Miller     Date: 5 Mar 1999

Consider:

    template <class T> void f(T&);
    template <class T> void f(const T&);
    void m() {
        const int p = 0;
        f(p);
    }
Some compilers treat this as ambiguous; others prefer f(const T&). The question turns out to revolve around whether 13.10.3.2 [temp.deduct.call] paragraph 2 says what it ought to regarding the removal of cv-qualifiers and reference modifiers from template function parameters in doing type deduction.

John Spicer: The partial ordering rules as originally proposed specified that, for purposes of comparing parameter types, you remove a top level reference, and after having done that you remove top level qualifiers. This is not what is actually in the IS however. The IS says that you remove top level qualifiers and then top level references.

The original rules were intended to prefer f(A<T>) over f(const T&).

Rationale (10/99): The Standard correctly reflects the intent of the Committee.

(October 2002) This is resolved by issue 214.