------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-07
19:30 -------
And another one (note on most targets a is passed by reference which is where
the problem comes
from):
extern "C" void abort( void );
struct A
{
A() { d = d2 = 0; width = -1; }
A( int _w ) : d( 0 ), d2( 0 ), width( _w ) {}
A b( const A &r ) const;
int d;
int d2;
int width;
};
A A::b( const A &r ) const
{
A tmp;
tmp.width = width < r.width ? width : r.width;
return tmp;
}
int main()
{
A a( 10 );
A b(100);
a = b.b( a );
if ( a.width != 10 )
abort();
}
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.0 Regression] forgets to |[4.0 Regression] removing a
|deep-copy temporary return |temporary return value when
|value |we cannot
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19317