Created on 2013-06-14.00:00:00 last changed 135 months ago
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.
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.
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:00 | admin | set | messages: + msg4714 |
2013-10-14 00:00:00 | admin | set | messages: + msg4713 |
2013-10-14 00:00:00 | admin | set | status: open -> nad |
2013-06-14 00:00:00 | admin | create |