Fix type in the changelog entry,
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / ivinline-7.C
blobb725db5cb1d74a9e54fea351695f5f324f70be79
1 /* Verify that simple virtual calls are inlined even without early
2    inlining, even when a typecast to an ancestor is involved along the
3    way and that ancestor is not the first one with virtual functions.  */
4 /* { dg-do run { target nonpic } } */
5 /* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp"  } */
7 extern "C" void abort (void);
9 class Distraction
11 public:
12   float f;
13   double d;
14   Distraction ()
15   {
16     f = 8.3;
17     d = 10.2;
18   }
19   virtual float bar (float z);
22 class A
24 public:
25   int data;
26   virtual int foo (int i);
30 class B : public Distraction, public A
32 public:
33   virtual int foo (int i);
36 float Distraction::bar (float z)
38   f += z;
39   return f/2;
42 int A::foo (int i)
44   return i + 1;
47 int B::foo (int i)
49   return i + 2;
52 int __attribute__ ((noinline,noclone)) get_input(void)
54   return 1;
57 static int middleman_1 (class A *obj, int i)
59   return obj->foo (i);
62 static int middleman_2 (class B *obj, int i)
64   return middleman_1 (obj, i);
67 int main (int argc, char *argv[])
69   class B b;
70   int i;
72   for (i = 0; i < get_input (); i++)
73     if (middleman_2 (&b, get_input ()) != 3)
74       abort ();
75   return 0;
78 /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target.*B::.*foo"  "inline"  } } */
79 /* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main"  "inline"  { xfail *-*-* } } } */