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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [p2736.C] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
// { dg-do run  }
2
// This is a poor test case, it is meant to ensure that function local
3
// statics are destroyed at the right time.  See PR 2736 for details.
4
// prms-id: 2736
5
 
6
#include 
7
 
8
int count;
9
 
10
struct A {
11
  int which;
12
  A(int i) :which(i) {
13
    // printf("ctor %x\n", this);
14
  }
15
  ~A() {
16
    // printf("dtor %x\n", this);
17
    if (++count != which)
18
      abort ();
19
    }
20
};
21
 
22
void
23
foo() {
24
  static A a(1);
25
}
26
 
27
A a(2);
28
 
29
int main() {
30
  foo();
31
}

powered by: WebSVN 2.1.0

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