Fix type in the changelog entry,
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-35.C
blob87f72b89984e8d9148a993871fa28972a12e1e56
1 /* { dg-options "-O2 -fdump-ipa-devirt-details -fdump-tree-fre1-details"  } */
2 struct A {virtual int t(void) {return 1;}};
3 struct B:A {B(); virtual int t(void) {return 2;}};
4 void test2(struct A *);
5 int
6 m(struct B *b)
8   struct A *a = new (B);
9   a->t(); // This call should be devirtualized by 
10           // FRE because we know type from ctor call
11   ((struct B *)a)->B::t(); // Make devirt possible 
12                            // C++ FE won't produce inline body without this
13   test2(a);
14   return a->t();  // This call should be devirtualized speculatively because
15                   //  test2 may change the type of A by placement new.
16                   // C++ standard is bit imprecise about this.
18 /* { dg-final { scan-tree-dump "converting indirect call to function virtual int B::t"  "fre1"  } } */
19 /* { dg-final { scan-ipa-dump "to virtual int B::t"  "devirt"  } } */
20 /* { dg-final { scan-ipa-dump "1 speculatively devirtualized"  "devirt"  } } */