Debian Codegraph @

gcc/testsuite/g++.dg/opt/musttail5.C

raw
1 // PR tree-optimization/119491
2 // { dg-do compile { target { external_musttail && c++11 } } }
3 // { dg-options "-O2" }
4
5 struct A {
6 struct B {};
7 A () {}
8 };
9 void qux ();
10 unsigned char v;
11 A w;
12 [[noreturn]] void foo (A);
13
14 template <typename T>
15 [[gnu::always_inline]] static inline void
16 bar (int &)
17 {
18 }
19
20 [[gnu::always_inline]] static inline void
21 baz (int *)
22 {
23 int r = 0;
24 bar<int> (r);
25 }
26
27 [[gnu::always_inline]] inline void
28 corge (A)
29 {
30 if (v)
31 qux ();
32 [[gnu::musttail]] return foo (w);
33 }
34
35 void
36 freddy (A)
37 {
38 int t;
39 baz (&t);
40 [[gnu::musttail]] return corge (A{});
41 }