blob: 350a05192979b53933d77ed4a7d569c8763740e8 (
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
|
/* { dg-do run } */
struct Dummy {};
struct RefCount : public Dummy {
~RefCount(); /* Has to be non-pod. */
int *a;
int *b;
};
RefCount::~RefCount(){}
struct Wrapper : public Dummy { RefCount ref; };
void __attribute__((noinline,noclone))
Push(Wrapper ptr)
{
*ptr.ref.b = 0;
}
extern "C" void abort (void);
int main()
{
int a = 1, b = 1;
Wrapper x;
x.ref.a = &a;
x.ref.b = &b;
Push(x);
if (b != 0)
abort ();
return 0;
}
|