aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/attr-musttail.cpp
blob: 2d0ca937f9b46eaef4e5e2ede5d1898b13ef86ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// RUN: %clang_cc1 -verify -fsyntax-only %s

int __attribute__((not_tail_called)) foo1(int a) {// expected-note {{'not_tail_called' attribute prevents being called as a tail call}}
    return a + 1;  
}


int foo2(int a) {
    [[clang::musttail]] 
    return foo1(a);  // expected-error {{cannot perform a tail call to function 'foo1' because its signature is incompatible with the calling function}} 
}

int main() {
    int result = foo2(10);      
    return 0;
}