sammccall added inline comments.

================
Comment at: clang/lib/Sema/SemaExpr.cpp:17489
+                                  : false;
+    // We can't use default capture by copy if any captures already specified
+    // capture by copy.
----------------
njames93 wrote:
> sammccall wrote:
> > While it's technically possible to transform `[&a, &b]` to `[=, &a, &b]`, 
> > it seems very unlikely the user actually wants this: we should capture the 
> > new variable by copy and make that the default, even though so far we've 
> > been listing captures explicitly and by reference.
> > 
> > On the other hand, transforming `[a, b]` to `[=]` seems more useful, but 
> > isn't supported.
> > 
> > I'd suggest just leaving both cases out - only offer a default capture if 
> > there are no explicit captures already.
> Transforming `[a, b]` to `[=]` is not a good idea imo. We would be replacing 
> perfectly legal, non ambiguous code.
> 
> The reason default capture fix-its are emitted last is because more often 
> than not they wont be the users intentions, however It's still nice to show 
> that it is a possibility.
> 
> 
I don't think fixits are for surfacing code transformations that are unlikely 
to be what the user wants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96975

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to