This is an archive of the discontinued LLVM Phabricator instance.

[cxx2a] P0624R2 fix: only lambdas with no lambda-capture are default-constructible and assignable.
ClosedPublic

Authored by logan-5 on Jul 1 2019, 9:15 PM.

Details

Summary

This is a fix for rG864949 which only disabled default construction and assignment for lambdas with capture-defaults, where the C++2a draft disables them for lambdas with any lambda-capture at all.

Diff Detail

Repository
rL LLVM

Event Timeline

logan-5 created this revision.Jul 1 2019, 9:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 9:15 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dblaikie accepted this revision.Jul 8 2019, 12:40 PM

Looks good to me. (possible the check (for no default capture and no captures) could be unified with the same check/language used for the implicit function pointer conversion operator ("if (Captures.empty() && CaptureDefault == LCD_None)" - around 1744 in SemaLambda.cpp) - maybe a common utility function to test this condition or the like. But it's hardly a big thing to have it written in two places, really)

This revision is now accepted and ready to land.Jul 8 2019, 12:40 PM
rsmith accepted this revision.Jul 8 2019, 12:45 PM

Do you have commit access or do you need someone to commit this for you?

I had the exact same thought about factoring out this and the function pointer conversion condition. I didn't bother, but I agree it could be a useful function to have.

I believe I need someone to commit it for me... brand new to all this and unsure, frankly.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2019, 4:24 PM