
7 Feb
2004
7 Feb
'04
11:23 a.m.
Raoul Gough wrote:
struct A { A &as_lvalue () { return *this; } };
void foo (A const &);
void bar () { foo (A()); // #1 Can copy foo (A().as_lvalue()); // #2 Can't copy }
Lately we discovered that there is difference between #1 and #2 since #1 might produce a const object, since in case that additional temporary is introduced it is const, with all the following consequences (e.g. potential const optimizations that no compiler actually do). Rani