OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [init/] [ref15.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// PR c++/20416.  We correctly constructed the temporary S in foo(),
// PR c++/20416.  We correctly constructed the temporary S in foo(),
// but incorrectly destroyed it every time foo() was called.
// but incorrectly destroyed it every time foo() was called.
// When using a wrapped target, there is no way to override the exit
// When using a wrapped target, there is no way to override the exit
// code after returning from main.
// code after returning from main.
// { dg-do run { target unwrapped } }
// { dg-do run { target unwrapped } }
extern "C" void abort (void);
extern "C" void abort (void);
extern "C" void _exit (int);
extern "C" void _exit (int);
int c, exiting;
int c, exiting;
struct S {
struct S {
  S() { ++c; }
  S() { ++c; }
  S(const S &) { ++c; }
  S(const S &) { ++c; }
  ~S()
  ~S()
  {
  {
    if (!exiting) abort ();
    if (!exiting) abort ();
    _exit (0);
    _exit (0);
  }
  }
};
};
void
void
foo (void)
foo (void)
{
{
  static const S &s = S();
  static const S &s = S();
}
}
int main ()
int main ()
{
{
  if (c != 0)
  if (c != 0)
    abort ();
    abort ();
  foo ();
  foo ();
  foo ();
  foo ();
  if (c != 1)
  if (c != 1)
    abort ();
    abort ();
  exiting = 1;
  exiting = 1;
  return 1;
  return 1;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.