2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr41186.C
blobfdfee2cd373fa0cb9d65ccc0791d175d29b61762
1 /* { dg-do run } */
3 struct Foo {
4   Foo() {};
5   int i;
6   short f;
7 };
8 struct Bar : public Foo {
9   Bar() {};
10   short b;
13 extern "C" void abort(void);
15 int main()
17   Bar b1, b2;
18   b2.i = 0;
19   b1.f = 0;
20   b1.b = 1;
21   b2.f = 1;
22   b2.b = 2;
23   static_cast<Foo&>(b1) = static_cast<Foo&>(b2);
24   if (b1.i != 0 || b1.b != 1)
25     abort ();
26   if (b1.f != 1)
27     abort ();
28   return 0;