blob: 4516b1e325653b490e1e0da02b6e10fa4fe4b2a1 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// PR c++/70147
// { dg-do run }
// { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" }
static int ac, ad, bc, bd, cc, cd, dc, dd;
struct A
{
A ()
{
ac++;
}
virtual void f ()
{
}
__attribute__ ((noinline)) ~ A ();
};
struct D
{
__attribute__ ((noinline)) D (int);
~D ()
{
dd++;
}
};
struct B: virtual A, D
{
B ():D (1)
{
bc++;
}
virtual void f ()
{
}
~B ()
{
bd++;
}
};
struct C: B, virtual A
{
C ()
{
cc++;
}
~C ()
{
cd++;
}
};
D::D (int x)
{
if (x)
throw 1;
dc++;
}
__attribute__ ((noinline, noclone))
void foo (A * p)
{
p->f ();
}
A::~A ()
{
foo (this);
ad++;
}
int
main ()
{
try
{
C c;
}
catch ( ...)
{
}
if (ac != 1 || ad != 1 || bc || bd || cc || cd || dc || dd)
__builtin_abort ();
}
|