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