Title
Partial ordering and reference collapsing
Status
open
Section
13.10.3.5 [temp.deduct.partial]
Submitter
Michael Wong

Created on 2010-11-08.00:00:00 last changed 163 months ago

Messages

Date: 2010-11-08.00:00:00

The current partial ordering rules produce surprising results in the presence of reference collapsing.

Since partial ordering is currently based solely on the signature of the function templates, the lack of difference following substitution of the template type parameter in the following is not taken into account.

Especially unsettling is that the allegedly "more specialized" template (#2) is not a candidate in the first call where template argument deduction fails for it despite a lack of non-deduced contexts.

    template <typename T>
    void foo(T&&);  // #1

    template <typename T>
    void foo(volatile T&&);  // #2

    int main(void) {
      const int x = 0;
      foo(x);  // calls #1 with T='const int &'
      foo<const int &>(x);  // calls #2
    }
History
Date User Action Args
2010-11-08 00:00:00admincreate