[clang] [Clang][Sema]:Fix musttail attribute on a function with not_tail_called attribute has no warning/error (PR #134465)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 11 01:54:10 PDT 2025
================
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+
+int __attribute__((not_tail_called)) foo1(int a) {
+ return a + 1;
+}
+
+
+int foo2(int a) {
+ [[clang::musttail]]
+ return foo1(a); // expected-error{{cannot perform a tail call to function'musttail' because its signature is incompatible with the calling function}}
----------------
MillePlateaux wrote:
> This diagnostic seems odd to me because of `function'musttail'` Is there really no whitespace there?
@AaronBallman Since we reuse ``err_musttail_mismatch``, and the function itself does not have spaces, I tried to add spaces , but the test case did not pass.I've pasted the code below.
```cpp
def err_musttail_mismatch : Error<
"cannot perform a tail call to function%select{| %1}0 "
"because its signature is incompatible with the calling function">;
https://github.com/llvm/llvm-project/pull/134465
More information about the cfe-commits
mailing list