[Bug c++/19317] [4.0 Regression] forgets to deep-copy temporary return value

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Jan 7 19:26:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-07 19:26 -------
Hmm,
  a = b (&a, &D.1613);

I think the problem is that we cannot remove the tempory return value for this testcase.
Here is another testcase which is related testcase:
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;
    int d;
    int d2;
    int width;
};

A A::b( ) const
{
    A tmp;
    tmp.width = 10+this->width;
    return tmp;
}

int main()
{
        A a( 100 );
        a = a.b();
        if ( a.width != 110 )
               abort();
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-07 19:26:28
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19317



More information about the Gcc-bugs mailing list