gcc/testsuite/c-c++-common/musttail4.c
raw| 1 | /* { dg-do compile { target { musttail && { c || c++11 } } } } */ |
| 2 | |
| 3 | struct box { char field[64]; int i; }; |
| 4 | |
| 5 | struct box __attribute__((noinline,noclone,noipa)) |
| 6 | returns_struct (int i) |
| 7 | { |
| 8 | struct box b; |
| 9 | b.i = i * i; |
| 10 | return b; |
| 11 | } |
| 12 | |
| 13 | int __attribute__((noinline,noclone)) |
| 14 | test_1 (int i) |
| 15 | { |
| 16 | [[gnu::musttail]] return returns_struct (i * 5).i; /* { dg-error "cannot tail-call: " } */ |
| 17 | } |