This is an archive of the discontinued LLVM Phabricator instance.

[clang] Error on substitution failure within lambda body inside a requires-expression
ClosedPublic

Authored by Fznamznon on Aug 3 2023, 5:27 AM.

Details

Summary

Per CWG 2672 substitution failure within the body of a lambda inside a
requires-expression should be a hard error.

Fixes https://github.com/llvm/llvm-project/issues/64138

Diff Detail

Event Timeline

Fznamznon created this revision.Aug 3 2023, 5:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 5:27 AM
Fznamznon requested review of this revision.Aug 3 2023, 5:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 5:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
cor3ntin accepted this revision.EditedAug 3 2023, 5:40 AM

Thanks for the PR!

Can you add a test in dr26xx ?

Also, i think the intent is that only the body is in the immediate context.

maybe we need a test like

requires {   
   decltype([] -> T {})::foo();
}

Because I think the intent is for that to work (@rsmith?)

clang/lib/Sema/SemaTemplateInstantiate.cpp
1100–1103

Can you also add
// CWG2672: A lambda-expression body is never in the immediate context ?

This revision is now accepted and ready to land.Aug 3 2023, 5:40 AM
cor3ntin requested changes to this revision.Aug 3 2023, 5:44 AM

Oups, I did not meant to accept that, sorry!

This revision now requires changes to proceed.Aug 3 2023, 5:44 AM
Fznamznon updated this revision to Diff 546837.Aug 3 2023, 6:36 AM

Rebase, apply feedback

Can you add a test in dr26xx ?

Sure, done. Hope I updated cxx_dr_status in the right way. The script wasn't happy until I added "open" to the test comment.

maybe we need a test like Because I think the intent is for that to work

Seems to be working if I got it right.

cor3ntin accepted this revision.Aug 5 2023, 5:29 AM

LGTM, thanks!

This revision is now accepted and ready to land.Aug 5 2023, 5:29 AM