On Tue, Mar 25, 2025 at 07:43:28PM +0300, Alexander Monakov wrote:
> Hello,
> 
> FWIW I think Clang made a mistake in bending semantics in a way that is 
> clearly
> misaligned with the general design of C and C++, where a language-native, so 
> to
> speak, solution was available: introduce a scope for the local variables to
> indicate that they cannot escape to the intended tailcall:
> 
> void foo(int v)
> {
>   {
>     int a;
>     capture(&a);
>   }
>   tailcall(v); // this cannot refer to 'a', even though it escaped earlier
> }

This is not a universal fix? e.g. consider a case like

void foo(int v)
{
   int a;
   capture(&a); 
   if (condition)
     return tailcall(v);
   // do something with a
}

-Andix> 

Reply via email to