njames93 added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:17444
+    if (CXXRecordDecl *RD = T->getAsCXXRecordDecl()) {
+      if (RD->hasSimpleCopyConstructor())
+        return true;
----------------
sammccall wrote:
> I suspect you need to handle the case where RD is incomplete
I thought that could be skipped, but yeah you're right you could have a lambda 
parameter be an incomplete type if you're only referencing it.


================
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.
----------------
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.




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