[PATCH] D144866: [clang] Fix aggregate initialization inside lambda constexpr

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 28 10:45:20 PST 2023


shafik added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:8763
     if (isLambdaCallOperator(Info.CurrentCall->Callee)) {
-      // Ensure we actually have captured 'this'. (an error will have
-      // been previously reported if not).
+      // Ensure we actually have captured 'this'. If something was wrong with
+      // 'this' capture, the error would have been previously reported.
----------------
shafik wrote:
> Fznamznon wrote:
> > shafik wrote:
> > > It might be worth it to review all the examples here: https://eel.is/c++draft/expr.prim.lambda
> > > 
> > > and make sure the test we have actually covers all the scenarios. It looks like we capture most of them but I have not gone over them fully.
> > At least the ones about `this` capture seem to be working and covered. Not all of them have the same behavior as described though, for example on https://eel.is/c++draft/expr.prim.lambda#closure-6 clang complains about missing capture, though gcc agrees https://godbolt.org/z/hfxbEP5fW , so this is probably a bug in the example. Anyway I think this is a bit out of the scope of the patch.
> I will dig into that discrepancy. 
If you move the lambda to be a global, it works: https://godbolt.org/z/84ax7518o which is what the original example has.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144866/new/

https://reviews.llvm.org/D144866



More information about the cfe-commits mailing list