URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [temps5.C] - Rev 154
Compare with Previous | Blame | View Log
// { dg-do run }
// GROUPS passed temps
// temps file
// Message-Id: <9311171029.AA00592@mencon>
// From: gfm@mencon.mencon.oz.au (Graham Menhennitt)
// Subject: gcc 2.5.3 - bug deleting object that is still referred to
// Date: Wed, 17 Nov 93 21:29:23 EST
#include <stdio.h>
class C {
public:
C(int i) : val(i) { ; }
C(const C& c) : val(c.val) { ; }
~C(void) { val = 999; }
C& operator = (const C& c) { val = c.val; return *this; }
C& inc(int i) { val += i; return *this; }
int val;
};
C
f(void)
{
return C(3);
}
C
f(int i)
{
return f().inc(i);
}
int
main(void)
{
if (f (2).val != 5)
{ printf ("FAIL\n"); return 1; }
else
printf ("PASS\n");
}