Open
Description
The following example fails to compile:
struct A
{
void fun(int x);
};
void blub(A*, int);
void A::fun(int x)
{
[[clang::musttail]] return blub(this, x); // error: non-static member function cannot perform a tail call to non-member function 'blub'
}
This is, however, unnecessary. On many targets, a tail call would be perfectly possible here. In fact, clang will happily generate a tail call if the attribute is removed: https://godbolt.org/z/xKbcf71EM. gcc accepts this example: https://godbolt.org/z/d3f6b1b5c.