[clang] [Clang] Fix handling of placeholder variables name in init captures (PR #107055)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 03:06:44 PDT 2024


cor3ntin wrote:

The second was clearly duplicated.
The first one introduce a scope for the captures, so that captures are available in the declaration of the lambda (before its compound statement).

But the body introduces a new scope wherein we inject the parameters - and we also need to reinject the captures to make sure they cannot be shadowed by a local variables

````cpp
[a = 0] 
// capture scope
{
 // body scope
 int a = 42; // error!
}
 ```   


https://github.com/llvm/llvm-project/pull/107055


More information about the cfe-commits mailing list