$ cat test.cpp
void foobar() noexcept;
void dance() noexcept {
#ifdef MUSTTAIL
[[clang::musttail]]
#endif
return foobar();
}
$ clang++ -std=c++20 -c -o /dev/null -DMUSTTAIL test.cpp
test.cpp:7:9: error: cannot compile this tail call skipping over cleanups yet
7 | return foobar();
| ^~~~~~~~
1 error generated.
The attempt to tail call fails because the caller (dance) is marked as noexcept, which causes EHTerminateScope to be pushed onto the EHStack.
I think clang should be able to do the tail call as there's no cleanup code that has to be emitted after the call in this case.