This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Fix a crash when taking the address of a consteval lambda
ClosedPublic

Authored by cor3ntin on Feb 23 2023, 2:08 AM.

Details

Summary

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

Diff Detail

Event Timeline

cor3ntin created this revision.Feb 23 2023, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 2:08 AM
cor3ntin requested review of this revision.Feb 23 2023, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 2:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin updated this revision to Diff 499773.Feb 23 2023, 2:10 AM

Release notes + formatting

cor3ntin added reviewers: aaron.ballman, Restricted Project.Feb 23 2023, 2:11 AM
aaron.ballman accepted this revision.Feb 23 2023, 5:48 AM

LGTM with a minor cleanup.

clang/lib/Sema/SemaExpr.cpp
17976–17984

Minor simplification, NFC.

This revision is now accepted and ready to land.Feb 23 2023, 5:48 AM