Consider: #include <iostream>
struct S { S(): i(2) {} S(S const&) {} int i; }; void f(S x) { x.i = 0; } int main() { S y; f(static_cast<S&&>(y)); std::cout << y.i << '\n'; } Expected output: 2 Actual output: 0 Thus, the assignment to the independent local variable x in f somehow modifies y. That can't be right, not even with that static_cast to S&&, can it? -- Summary: function modifying argument received by-value affects caller's variable when passed as rvalue Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc-bugzilla at contacts dot eelis dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36744