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);
19 virtual float bar (float z);
26 virtual int foo (int i);
30 class B : public Distraction, public A
33 virtual int foo (int i);
36 float Distraction::bar (float z)
52 int __attribute__ ((noinline,noclone)) get_input(void)
57 static int middleman_1 (class A *obj, int i)
62 static int middleman_2 (class B *obj, int i)
64 return middleman_1 (obj, i);
67 int main (int argc, char *argv[])
72 for (i = 0; i < get_input (); i++)
73 if (middleman_2 (&b, get_input ()) != 3)
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 *-*-* } } } */
80 /* { dg-final { cleanup-ipa-dump "inline" } } */