Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / ipa / devirt-37.C
blobb7f52a0a5e9d350b22d76a1cf8c85f24ac926d6f
1 /* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre3-details -fno-early-inlining"  } */
2 #include <stdlib.h>
3 struct A {virtual void test() {abort ();}};
4 struct B:A
5    {virtual void test() {}
6     B();
7     B(void (*test)(struct A *));};
9 void extcall(void);
11 inline void tt(struct A *a)
13   a->test();
16 __attribute__ ((always_inline))
17 inline
18 B::B (void (*test)(struct A *))
20   struct B c;
21   struct A *a=this;
22   extcall();
23   test(a);
25 void
26 t()
28   struct B b(tt);
30 /* After inlining the call within constructor needs to be checked to not go into a basetype.
31    We should see the vtbl store and we should notice extcall as possibly clobbering the
32    type but ignore it because b is in static storage.  */
33 /* { dg-final { scan-tree-dump "No dynamic type change found."  "fre3"  } } */
34 /* { dg-final { scan-tree-dump "Checking vtbl store:"  "fre3"  } } */
35 /* { dg-final { scan-tree-dump "Function call may change dynamic type:extcall"  "fre3"  } } */
36 /* { dg-final { scan-tree-dump "converting indirect call to function virtual void"  "fre3"  } } */