c++/modules: Stream warning suppressions [PR115757]
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-15.C
blob4a899d4178a68c9e28b3be9005fef87bbc697cff
1 /* Check that we speculatively devirutalize call to FOO to B::foo becuase
2    A is noreturn.  */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -fdump-ipa-devirt-details -fdump-tree-optimized"  } */
5 /* { dg-add-options bind_pic_locally } */
7 class A {
8 public:
9   virtual int foo(void)
10     {
11       throw (1);
12       return 0;
13     }
17 class B : public A {
18 public:
19   virtual int foo(void);
22 int
23 B::foo(void)
25   return 1;
27 class A a, *b=&a;
28 void
29 m(void)
31   b->foo();
33 int main()
35   m();
38 /* { dg-final { scan-ipa-dump "speculatively devirtualizing call" "devirt"} } */
39 /* Match if (PROF_6 == foo) to verify that the speculation survived.  */
40 /* { dg-final { scan-tree-dump "== foo" "optimized"} } */