gcc/ChangeLog:
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-17.C
blob9edc205ce52944d3bcd5fcade213ce6f197776f3
1 /* We shall devirtualize to B::foo since it is the only live candidate of an
2    anonymous type.  */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -fdump-ipa-whole-program-details"  } */
5 namespace {
6 class B {
7 public:
8   virtual int foo(void)
10   return 0;
13 class A : public B {
14 public:
15   virtual int foo(void)
17   return 1;
21 class B *b;
22 void get_me_lost (void *);
23 int main()
25   int c;
26   if (c)
27     {
28     class A a;
29     a.foo();
30     }
31   else
32     {
33     b = new (class B);
34     b->foo();
35         get_me_lost ((void *)&b);
36     }
37   return b->foo();
40 /* { dg-final { scan-ipa-dump-not "builtin_unreachable" "whole-program"} } */
41 /* { dg-final { scan-ipa-dump "B::foo" "whole-program"} } */
42 /* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */