clang/test/Sema/attr-musttail.cpp
raw| 1 | // RUN: %clang_cc1 -verify -fsyntax-only %s |
| 2 | |
| 3 | int __attribute__((not_tail_called)) foo1(int a) {// expected-note {{'not_tail_called' attribute prevents being called as a tail call}} |
| 4 | return a + 1; |
| 5 | } |
| 6 | |
| 7 | |
| 8 | int foo2(int a) { |
| 9 | [[clang::musttail]] |
| 10 | return foo1(a); // expected-error {{cannot perform a tail call to function 'foo1' because its signature is incompatible with the calling function}} |
| 11 | } |
| 12 | |
| 13 | int main() { |
| 14 | int result = foo2(10); |
| 15 | return 0; |
| 16 | } |
| 17 |