Rebase.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-26.C
blob1787fee86731f2880f0521479d4e7b2428b487b8
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fdump-tree-ccp1"  } */
3 struct A
4  {
5    int a;
6    virtual int bar(void) {return a;}
7  };
8 struct B
9  {
10    virtual int foo(void) {return b;}
11    int b;
12  };
13 struct C: A,B
14  {
15    virtual int foo(void) {return a;}
16  };
18 struct C c;
19 int test(void)
21   struct C *d=&c;
22   struct B *b=d;
23   return d->foo()+b->foo();
25 /* The call to b->foo() is perfectly devirtualizable because C can not be in construction
26    when &c was used.  */
27 /* { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "ccp1"  } } */
28 /* { dg-final { cleanup-tree-dump "ccp1" } } */