[PATCH] D95691: Implement P2173 for attributes on lambdas
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 3 15:53:17 PST 2021
rsmith added a comment.
In D95691#2540450 <https://reviews.llvm.org/D95691#2540450>, @rjmccall wrote:
> The patch seems technically okay to me. Do we need to recognize lambdas in any tentative-parse situations, or is it always the reverse (e.g. recognizing ObjC message sends as not-a-lambda)?
Disambiguation with ObjC message sends never looks past the `]` of the lambda introducer, so I think that's fine. And the disambiguation for `[[` won't kick in here, because we've already committed to the `[...] [[` introducing a lambda before we parse the attributes. The disambiguation for `int a[] = { [n] = 0 };` also looks OK: it looks for an `=` after the `]`, which we can still use to disambiguate as an array designator rather than a lambda.
I think the error recovery disambiguation logic for `delete [] { return p; } ();` won't work if the lambda has attributes, but that seems fine: that's a best-effort recovery anyway.
> The warning is a bit weird. If we don't think it's certain that the committee will adopt this syntax, I don't think we should add this patch at all; it is not really acceptable to add it and then treat it as a Clang extension if the committee rejects it. If we do think it's certain, we should go ahead and consider this a feature of the next major standard.
I think it's quite unlikely that the committee would reject the feature at this stage. Seems OK to me to jump the gun slightly and call this a C++23 extension.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95691/new/
https://reviews.llvm.org/D95691
More information about the cfe-commits
mailing list