[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr41186.C
blob9588198629952a401fcff35d4c1931fb924f9af9
1 /* { dg-do compile } */
2 /* { dg-options "-O -fno-tree-sra -fdump-tree-fre1-details" } */
4 struct Foo {
5   Foo() {};
6   int i;
7   short f;
8 };
9 struct Bar : public Foo {
10   Bar() {};
11   short b;
14 extern "C" void abort(void);
16 int main()
18   Bar b1, b2;
19   b2.i = 0;
20   b1.f = 0;
21   b1.b = 1;
22   b2.f = 1;
23   b2.b = 2;
24   static_cast<Foo&>(b1) = static_cast<Foo&>(b2);
25   if (b1.i != 0 || b1.b != 1)
26     abort ();
27   if (b1.f != 1)
28     abort ();
29   return 0;
32 /* { dg-final { scan-tree-dump "Replaced b1.b with 1" "fre1" } } */
33 /* { dg-final { scan-tree-dump "Replaced b1.D.\[0-9\]*.i with 0" "fre1" } } */
34 /* { dg-final { scan-tree-dump "Replaced b1.D.\[0-9\]*.f with 1" "fre1" } } */