Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / pr66616.C
blob440ea6c6bfc1b75d370882bdf5415fa712541c2b
1 // { dg-do run }
2 // { dg-options "-O2 -fipa-cp-clone" }
4 struct Distraction
6   char fc[8];
7   virtual Distraction * return_self ()
8   { return this; }
9 };
11 static int go;
13 struct A;
15 struct A
17   int fi;
19   A () : fi(0) {}
20   A (int pi) : fi (pi) {}
21   virtual void foo (int p) = 0;
24 struct B;
26 struct B : public Distraction, A
28   B () : Distraction(), A() { }
29   B (int pi) : Distraction (), A (pi) {}
30   virtual void foo (int p)
31   {
32     int o = fi;
33     for (int i = 0; i < p; i++)
34       o += i + i * i;
35     go = o;
36   }
39 struct B gb2 (2);
41 extern "C" void abort (void);
43 int
44 main (void)
46   for (int i = 0; i < 2; i++)
47     {
48       struct A *p = &gb2;
49       p->foo (0);
50       if (go != 2)
51         abort ();
52     }
53   return 0;