[PATCH] D123909: [Clang] Use of decltype(capture) in parameter-declaration-clause

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 05:30:00 PDT 2022

aaron.ballman added inline comments.

Comment at: clang/include/clang/Sema/Sema.h:5281
+                                              SourceLocation TemplateKwLoc,
+                                              bool HasTrailingLParen);
cor3ntin wrote:
> aaron.ballman wrote:
> > This parameter is always false, so it seems like it can be dropped.
> Not if we extend to `sizeof id` - I guess i can drop it for now?
I'd drop for now -- we can add it in later when we get around to doing the full core issue once it's settled.

Comment at: clang/lib/Parse/ParseExprCXX.cpp:700
+  if (Tok.is(tok::identifier) && NextToken().is(tok::r_paren)) {
+    SourceLocation TemplateKWLoc;
cor3ntin wrote:
> aaron.ballman wrote:
> > This feels surprisingly restrictive to me, but it's sufficient for getting libstdc++ working again.
> I've can't think of another kind of unqualified-id that could refer to a capturable entity here.
> Do you know what would be missing?
> Also, without being very restrictive, I'm not sure how this is implementable
What I find restrictive is that it requires an unqualified-id *only* to kick in as being maybe mutable agnostic. e.g., `decltype(id)` and `decltype(+id)` (where the unary + may be an overloaded operator that depends on the mutability of the `this` object).

(I'm not seeing the principle that guides this restriction proposed in the core issue yet, but those can be hashed out later.)

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list