I have a code:
void f(int&& i) {
auto lambda = [](int&& j) { (void)j; }
lambda(i);
}
int main() {
f(5);
}
Clang++ gives an error: no known conversion from 'int' to 'int &&' for 1st argument
Why the i
changes its type to int
when being passed to the lambda()
?