------- Comment #3 from pluto at agmk dot net 2007-09-23 18:31 ------- (In reply to comment #0)
> If this function is called from GDB, and the called function modifies > its argument, it will end up modifying the original copy. > It's supposed to get a temporary copy. compiler does the temporary copy. please look at this example: $ cat 33537.cpp struct X { X(); X( X const& ); int var; }; int f( X arg ) { arg.var = 0; return arg.var; } int main() { X x; f( x ); return 0; } at tree dump we see the temporary object passed to f(X) by reference: int f(X) (arg) { arg->var = 0; return 0; } int main() () { struct X x; struct X D.2360; __comp_ctor (&x); __comp_ctor (&D.2360, &x); f (&D.2360); return 0; } -- pluto at agmk dot net changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pluto at agmk dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33537