------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-10
05:03 -------
Also we only remove the temporary variable if the size is "large" which seems
wrong.
Here is another example and the reason why it works with the C front-end is
because we don't do NRV
until late:
extern "C" void abort( void );
typedef struct A
{
int width;
int width1;
int width3;
int width5;
}A;
A bb( const A*this1, const A *r )
{
A tmp;
tmp.width = -1;
tmp.width += this1->width < r->width ? this1->width : r->width;
return tmp;
}
int main()
{
A a;
a.width = ( 10 );
A b;
b.width = (100);
a = bb( &b, &a );
if ( a.width != 9 )
abort();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19317