Title
Does the special rvalue-reference deduction apply to alias templates?
Status
nad
Section
13.10.3.2 [temp.deduct.call]
Submitter
Daveed Vandevoorde

Created on 2013-06-14.00:00:00 last changed 135 months ago

Messages

Date: 2013-09-15.00:00:00

Rationale (September, 2013):

Because the types of the function parameters are the same, regardless of whether written directly or via an alias template, deduction must be handled the same way in both cases.

Date: 2013-10-15.00:00:00

Additional note (October, 2013):

It was observed that the type of the parameter would be the same whether written as T&& or as RR<T>, which would require that deduction be performed the same, regardless of how the type was written.

Date: 2013-06-14.00:00:00

An rvalue reference type involving a template parameter receives special treatment in template argument deduction in 13.10.3.2 [temp.deduct.call] paragraph 3:

If P is an rvalue reference to a cv-unqualified template parameter and the argument is an lvalue, the type “lvalue reference to A” is used in place of A for type deduction.

Does this rule apply when the parameter type involves an alias template instead of using a template parameter directly? For example:

    template<class T> using RR = T&&;

    template<class T> struct X {};
    template<class T> struct X<T&&>; // Leave incomplete to possibly trigger an error

    template<class T> void g(RR<T> p) {
      X<decltype(p)> x;
    }

    int main() {
      int x = 2;
      g(x);
    }

There is implementation variance on the treatment of this example.

History
Date User Action Args
2013-10-14 00:00:00adminsetmessages: + msg4714
2013-10-14 00:00:00adminsetmessages: + msg4713
2013-10-14 00:00:00adminsetstatus: open -> nad
2013-06-14 00:00:00admincreate