OpenCores
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] - Blame information for rev 308

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// PR c++/20416.  We correctly constructed the temporary S in foo(),
2
// but incorrectly destroyed it every time foo() was called.
3
// When using a wrapped target, there is no way to override the exit
4
// code after returning from main.
5
// { dg-do run { target unwrapped } }
6
extern "C" void abort (void);
7
extern "C" void _exit (int);
8
 
9
int c, exiting;
10
struct S {
11
  S() { ++c; }
12
  S(const S &) { ++c; }
13
  ~S()
14
  {
15
    if (!exiting) abort ();
16
    _exit (0);
17
  }
18
};
19
void
20
foo (void)
21
{
22
  static const S &s = S();
23
}
24
int main ()
25
{
26
  if (c != 0)
27
    abort ();
28
  foo ();
29
  foo ();
30
  if (c != 1)
31
    abort ();
32
  exiting = 1;
33
  return 1;
34
}

powered by: WebSVN 2.1.0

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