[PATCH] D132945: [clang] Skip re-building lambda expressions in parameters to consteval fns.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 01:42:20 PDT 2022


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

Thanks, that's a nice find!

Could you also add a test that mentions uses `consteval` functions in lambda captures inside immediate invocations?
Something like `consteval_foo([x = consteval_foo(1)]() consteval { return x; })` and maybe also without `consteval` on lambda parameter list.
I suspect this should work as expected, just wanted to make sure we capture this in tests



================
Comment at: clang/docs/ReleaseNotes.rst:196
+
+- Skip re-building lambda expressions when they appear as parameters to an immediate invocation.
+  This fixes `GH56183 <https://github.com/llvm/llvm-project/issues/56183>`_,
----------------
NIT


================
Comment at: clang/lib/Sema/SemaExpr.cpp:17601-17605
+    ExprResult TransformLambdaExpr(LambdaExpr *E) {
+      // Lambdas must be built already. They must not be re-built as it always
+      // creates new types.
+      return E;
+    }
----------------
NIT: I tried to expand the meaning of term 'built' to make the comment a bit clearer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132945



More information about the cfe-commits mailing list