[PATCH] D83681: [clang] Provide a more specific diagnostic for a misplaced lambda capture-default.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 08:03:48 PDT 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:937
+      return Invalid([&] {
+        Diag(Tok.getLocation(), diag::err_capture_default_first);
+      });
----------------
riccibruno wrote:
> aaron.ballman wrote:
> > Would it make sense to provide a fix-it to move the capture default to the start of the list automatically, or is that a pain?
> I have thought about doing that, but my understanding is that a fix-it must fix the error. But here the capture-default might conflict with one of the other captures (both before and after). 
> 
> To make sure that the fix-it is safe we would have to look at the other captures (before and after). This is certainly not impossible but a bit more tricky.
That's a good reason to not do it right now, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83681/new/

https://reviews.llvm.org/D83681





More information about the cfe-commits mailing list