https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119615

            Bug ID: 119615
           Summary: Divergence with Clang on musttail (differing tailcall
                    target signature)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

For the following (gnarly reduction from PR119614):
```
char *h() {
  return 0;
}

const char *p(int) {
  [[clang::musttail]] return h();
}
```

We accept it, while Clang rejects it with:
```
a.cxx:6:23: error: cannot perform a tail call to function 'h' because its
signature is incompatible with the calling function
    6 |   [[clang::musttail]] return h();
      |                       ^
a.cxx:1:1: note: target function has different number of parameters (expected 1
but has 0)
    1 | char *h() {
      | ^
a.cxx:6:5: note: tail call required by 'musttail' attribute here
    6 |   [[clang::musttail]] return h();
      |     ^
1 error generated.
```

Reply via email to