RTEMS: Add Cortex-M33 multilib
[gcc.git] / gcc / testsuite / g++.dg / musttail10.C
bloba43d8a6fde7e8f017a93937fa4ce09c0ab0aa779
1 /* { dg-do compile { target { musttail } } } */
2 /* { dg-options "-std=gnu++11" } */
3 /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
5 template <class T> T f();
7 double g() { [[gnu::musttail]] return f<int>(); } /* { dg-error "cannot tail-call" } */
9 template <class T>
10 __attribute__((noinline, noclone, noipa))
11 T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target { ! external_musttail } } } */
13 template <class T>
14 __attribute__((noinline, noclone, noipa))
15 T g2() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target { ! external_musttail } } } */
17 template <class T>
18 __attribute__((noinline, noclone, noipa))
19 /* Would work with -O1.  */
20 T g3() { [[gnu::musttail]] return f<T>(); } /* { dg-error "cannot tail-call" } */
22 template <class T>
23 __attribute__((noinline, noclone, noipa))
24 T g4() { [[gnu::musttail]] return f<double>(); } /* { dg-error "cannot tail-call" } */
26 class C
28   double x;
29 public:
30   C(double x) : x(x) {}
31   ~C() { asm("":::"memory"); }
34 int main()
36   g1<int>();
37   g2<double>();
38   g3<C>();
39   g4<int>();