You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last line prints 1, but it should print 2 because f(param) is the definite last use of the param... Godbolt repro: https://cppx.godbolt.org/z/17noYP
struct X {};
void f(X const&) { cout << "1\n"; }
void f(X && ) { cout << "2\n"; }
void test(in X param) { f(param); }
int main() {
X x;
test(x); // 1
test(X()); // *** should be 2
}
The last line prints
1, but it should print2becausef(param)is the definite last use of theparam... Godbolt repro: https://cppx.godbolt.org/z/17noYP