RTEMS: Add Cortex-M33 multilib
[gcc.git] / gcc / testsuite / g++.dg / musttail6.C
blob5dcf302139ae5d7387befd29f158e07b3a023d8b
1 /* { dg-do compile { target { struct_musttail } } } */
2 /* { dg-require-effective-target external_musttail } */
3 /* A lot of architectures will not build this due to PR115606 and PR115607 */
4 /* { dg-options "-std=gnu++11" } */
5 /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
7 class Foo {
8 public:
9   int a, b;
10   Foo(int a, int b) : a(a), b(b) {}
13 Foo __attribute__((noinline,noclone,noipa))
14 callee (int i)
16   return Foo(i, i+1);
19 Foo __attribute__((noinline,noclone,noipa))
20 caller (int i)
22   [[gnu::musttail]] return callee (i + 1);
25 template<typename T>
26 T __attribute__((noinline,noclone,noipa)) foo (T i)
28   return i + 1;
31 int
32 caller2 (int k)
34   [[gnu::musttail]] return foo<int>(1);
37 template<typename T>
38 T caller3 (T v)
40   [[gnu::musttail]] return foo<T>(v);
43 int call3(int i)
45   [[gnu::musttail]] return caller3<int>(i + 1);
48 struct Bar {
49   int a;
50   Bar(int a) : a(a) {}
51   Bar operator+(Bar o) { return Bar(a + o.a); }
54 #if __OPTIMIZE__ >= 1
55 Bar
56 caller4 (Bar k)
58   [[gnu::musttail]] return caller3<Bar>(Bar(99));
60 #endif