[PATCH] D144627: [Clang] Fix a crash when taking the address of a consteval lambda

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 02:08:41 PST 2023


cor3ntin created this revision.
Herald added a project: All.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The `_invoke` function of lambdas was not respecting
the constexpr/consteval specifier of the call operator, so it was possible
to take its address in a non-immmediately invoked context,
even if the call operator was itself consteval.

In addition, we improve the diagnostic emmited in the lambda case
not to show that `invoke` method.

Fixes #57682


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144627

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/test/AST/ast-dump-expr-json.cpp
  clang/test/AST/ast-dump-expr.cpp
  clang/test/AST/ast-dump-lambda.cpp
  clang/test/SemaCXX/cxx2a-consteval.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144627.499772.patch
Type: text/x-patch
Size: 6079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230223/0bbd20f8/attachment-0001.bin>


More information about the cfe-commits mailing list