Created on 2009-03-27.00:00:00 last changed 190 months ago
[Voted into WP at March, 2010 meeting.]
Proposed resolution (July, 2009):
Replace the example in 13.10.3.2 [temp.deduct.call] paragraph 3 with:
template<typename T> int f(T&&);
template<typename T> int g(const T&&);
int i;
int n1 = f(i); // calls f<int&>(int&)
int n2 = f(0); // calls f<int>(int&&)
int n3 = g(i); // error: would call g<int>(const int&&), which would
// bind an rvalue reference to an lvalue
(See also issue 858.)
The adoption of paper N2844 made it ill-formed to attempt to bind an rvalue reference to an lvalue. However, the example in 13.10.3.2 [temp.deduct.call] paragraph 3 still reflects the previous specification:
template <typename T> int f(T&&);
int i;
int j = f(i); // calls f<int&>(i)
template <typename T> int g(const T&&);
int k;
int n = g(k); // calls g<int>(k)
The last line of that example is now ill-formed, attempting to bind the const int&& parameter of g to the lvalue k.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2010-03-29 00:00:00 | admin | set | messages: + msg2742 |
| 2010-03-29 00:00:00 | admin | set | status: ready -> cd2 |
| 2009-11-08 00:00:00 | admin | set | status: review -> ready |
| 2009-08-03 00:00:00 | admin | set | messages: + msg2188 |
| 2009-08-03 00:00:00 | admin | set | status: open -> review |
| 2009-03-27 00:00:00 | admin | create | |