Sirraide wrote:

> TODO: Consider `auto x = []() { /* lambda body */ };` which becomes `VarDecl` 
> holding `ExprWithCleanups` holding `CXXBindTemporaryExpr`.

Visiting `CXXBindTemporaryExpr` looks like the right approach. Speaking of 
lambdas, while looking into this, I also found some more issues with lambda 
captures I think:

```c++
struct S { ~S(); };
void f() {
    S s;
    [&]() [[clang::nonblocking]] {
        [s]{ auto x = &s; }();
        [=]{ auto x = &s; }();
    }();
}
```
These are all by-value captures, meaning that we need to call `~S()` after 
evaluating the two inner lambdas, but we don't seem to diagnose that at the 
moment (https://godbolt.org/z/815hj1bKM). This might well be a different issue 
though.

> We currently look for a destructor on a VarDecl but I suspect that becomes a 
> redundant check with this change. Need to verify.

That might no longer be necessary yeah.

https://github.com/llvm/llvm-project/pull/166110
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to