repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.mike
/
p2736.C
blob
a0a8b314338e1c24007a066e3c75ac6c4140d245
1
// { 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 <stdlib.h>
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
}