gcc/ChangeLog:
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-48.C
blob1aed85f8642dd8283d7210c2ac6430f675ef7c7b
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-cp -fdump-ipa-inline-details -fno-early-inlining" } */
3 struct A {
4    virtual int foo(){return 1;}
5 };
6 struct B:A {
7    virtual int foo(){return 2;}
8    void callfoo(){foo();}
9 };
10 struct C:A {
11    virtual int foo(){return 3;}
13 struct D:B {
14    virtual int foo(){return 4;}
15    void callfoo(){foo();}
17 static void
18 test (struct A *a)
20   if (a->foo() != 2)
21    __builtin_abort ();
23 int
24 m()
26   struct A *a = new C;
27   static_cast<B*>(a)->callfoo();
28   return 0;
31 /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target\[^\\n\]*__builtin_unreachable" 1 "inline"  } } */