Fix expected messages in test
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / imm-devirt-2.C
blob079aa4b6f15c0b37f587fba92d54e1ceaa15f334
1 /* Verify that virtual calls are folded even early inlining puts them into one
2    function with the definition.  */
3 /* { dg-do run } */
4 /* { dg-options "-O2 -fdump-tree-fre1-details"  } */
6 extern "C" void abort (void);
8 class Distraction
10 public:
11   float f;
12   double d;
13   Distraction ()
14   {
15     f = 8.3;
16     d = 10.2;
17   }
18   virtual float bar (float z);
21 class A
23 public:
24   int data;
25   virtual int foo (int i);
28 class B : public A
30 public:
31   int data_2;
32   virtual int foo (int i);
33   virtual int baz (int i);
37 class C : public Distraction, public B
39 public:
40   __attribute__ ((noinline)) C();
41   virtual int foo (int i);
44 float __attribute__ ((noinline)) Distraction::bar (float z)
46   f += z;
47   return f/2;
50 int __attribute__ ((noinline)) A::foo (int i)
52   return i + 1;
55 int __attribute__ ((noinline)) B::foo (int i)
57   return i + 2;
60 int __attribute__ ((noinline)) B::baz (int i)
62   return i * 15;
65 int __attribute__ ((noinline)) C::foo (int i)
67   return i + 3;
70 int __attribute__ ((noinline,noclone)) get_input(void)
72   return 1;
75 static inline int middleman (class A *obj, int i)
77   return obj->foo (i);
80 __attribute__ ((noinline)) C::C()
84 int main (int argc, char *argv[])
86   class C c;
88   if (middleman (&c, get_input ()) != 4)
89     abort ();
91   return 0;
94 /* { dg-final { scan-tree-dump "converting indirect call to function" "fre1"  } } */
95 /* { dg-final { cleanup-tree-dump "fre1" } } */