1 /* Verify that virtual calls are folded even early inlining puts them into one
2 function with the definition. */
4 /* { dg-options "-O2 -fdump-tree-einline" } */
6 extern "C" void abort (void);
12 virtual int foo (int i);
19 __attribute__ ((noinline)) B();
20 virtual int foo (int i);
23 int __attribute__ ((noinline)) A::foo (int i)
28 int __attribute__ ((noinline)) B::foo (int i)
33 int __attribute__ ((noinline,noclone)) get_input(void)
38 __attribute__ ((noinline)) B::B()
42 static inline int middleman_1 (class A *obj, int i)
47 static inline int middleman_2 (class B *obj, int i)
49 return middleman_1 (obj, i);
52 int main (int argc, char *argv[])
56 if (middleman_2 (&b, get_input ()) != 3)
61 /* middleman_2 gets early inlined and the virtual call should get turned to
63 /* { dg-final { scan-tree-dump "Inlining int middleman_1" "einline" } } */
64 /* { dg-final { scan-tree-dump "Inlining int middleman_2" "einline" } } */
65 /* { dg-final { scan-tree-dump "B::foo \\(" "einline" } } */
66 /* { dg-final { scan-tree-dump-times "OBJ_TYPE_REF" 2 "einline" } } */