Merge from trunk:
[official-gcc.git] / main / gcc / testsuite / g++.dg / ipa / devirt-34.C
blob5d56e1e0c8b35203f14a049453c495cb31e927dc
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-ipa-devirt"  } */
3 struct A {virtual int t(){return 42;}};
4 struct B:A {virtual int t(){return 1;}};
6 struct A aa;
7 struct B bb;
8 int
9 t(struct B *b)
11   struct A *a=b;
12   a->t();
15 /* We should guess that the pointer of type B probably points to an instance
16    of B or its derivates and exclude A::t from list of likely targets.  */
18 /* { dg-final { scan-ipa-dump "Targets that are not likely"  "devirt"  } } */
19 /* { dg-final { scan-ipa-dump "1 speculatively devirtualized"  "devirt"  } } */
20 /* { dg-final { cleanup-ipa-dump "devirt" } } */