OSDN Git Service

PR c++/46124
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr47541.C
1 /* { dg-do run } */
2
3 struct Dummy {};
4 struct RefCount : public Dummy {
5     ~RefCount(); /* Has to be non-pod.  */
6     int *a;
7     int *b;
8 };
9 RefCount::~RefCount(){}
10 struct Wrapper : public Dummy { RefCount ref; };
11 void __attribute__((noinline,noclone))
12 Push(Wrapper ptr)
13 {
14   *ptr.ref.b = 0;
15 }
16 extern "C" void abort (void);
17 int main()
18 {
19   int a = 1, b = 1;
20   Wrapper x;
21   x.ref.a = &a;
22   x.ref.b = &b;
23   Push(x);
24   if (b != 0)
25     abort ();
26   return 0;
27 }