[llvm-bugs] [Bug 34865] Clang doesn't require references to be listed in lambda capture
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 30 17:02:16 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34865
Richard Smith <richard-llvm at metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #4 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Reopening: while the warning may be correct, the location if the diagnostic is
not quite right. We should instead be pointing at the point of use:
test2.cpp:4:29: warning: lambda capture 'varRef' is not required to be captured
for this use [-Wunused-lambda-capture]
return [&varRef]{return varRef;}();
^
... and it'd be a good idea to add a note, something like:
test2.cpp:3:29: note: 'varRef' is a reference bound to a constant expression
evaluating to 'var'; that lvalue will be used in place of 'varRef' in the
lambda body
int& varRef = var;
^
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171031/48a90720/attachment.html>
More information about the llvm-bugs
mailing list