blob: aeb509bfa5d64956dbffaee91b30bd4e686dbec1 (
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
55
56
57
|
// { dg-do run }
// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Oct 2002 <nathan@codesourcery.com>
// From WindRiver SPR 80797
// We were inadvertently SAVE_EXPRing volatile arrays during delete[]
struct A
{
A *ptr;
static int ok;
A () {ptr = this;}
~A () {ok = ptr == this;}
};
int A::ok = -1;
struct B
{
B *ptr;
static int ok;
B () {ptr = this;}
~B () {ok = ptr == this;}
};
int B::ok = -1;
struct C
{
A volatile a;
B volatile b[1];
C ();
};
C::C ()
{
throw 1;
}
int main ()
{
try
{
C c;
}
catch (...)
{
if (A::ok != 1)
return 1;
if (B::ok != 1)
return 2;
return 0;
}
return 3;
}
|