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
/
misc1.C
blob
7a60218560944ee9e5a9ea7dd53ff132b2f83d4c
1
// { dg-do run }
2
// GROUPS passed construct-destruct
3
/* g++ constructs j 13 times, and destructs it once. */
4
5
extern "C" {
6
int printf (const char *, ...);
7
void exit(int);
8
}
9
10
void foo() {
11
}
12
13
class C {
14
int val;
15
public:
16
static int count;
17
C(int ii) {
18
val = ii;
19
++count;
20
printf("up\n");
21
}
22
~C() {
23
--count;
24
printf("down\n");
25
}
26
int operator ++() {
27
return ++val;
28
}
29
operator int() {
30
return val;
31
}
32
};
33
34
int C::count = 0;
35
36
void bar() {
37
for (int ii=0; ii<13; ++ii)
38
for (C j=1; j<9; ++j)
39
foo();
40
}
41
42
int main() {
43
bar();
44
if (C::count)
45
{
46
printf("FAIL\n");
47
exit(1);
48
}
49
else
50
{
51
printf("PASS\n");
52
}
53
return 0;
54
}