URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [init/] [ref15.C] - Rev 316
Go to most recent revision | Compare with Previous | Blame | View Log
// PR c++/20416. We correctly constructed the temporary S in foo(),
// but incorrectly destroyed it every time foo() was called.
// When using a wrapped target, there is no way to override the exit
// code after returning from main.
// { dg-do run { target unwrapped } }
extern "C" void abort (void);
extern "C" void _exit (int);
int c, exiting;
struct S {
S() { ++c; }
S(const S &) { ++c; }
~S()
{
if (!exiting) abort ();
_exit (0);
}
};
void
foo (void)
{
static const S &s = S();
}
int main ()
{
if (c != 0)
abort ();
foo ();
foo ();
if (c != 1)
abort ();
exiting = 1;
return 1;
}
Go to most recent revision | Compare with Previous | Blame | View Log