Clang emits unused-lambda-capture warning for captures in generic lambdas even though they are actually used.
Fixes PR31815.
Paths
| Differential D33526
Fix spurious Wunused-lambda-capture warning ClosedPublic Authored by kongyi on May 24 2017, 5:14 PM.
Details Summary Clang emits unused-lambda-capture warning for captures in generic lambdas even though they are actually used. Fixes PR31815.
Diff Detail
Event TimelineComment Actions Thanks for looking at this for me.
ahatanak added inline comments.
Comment Actions I don't understand why init captures have this problem. Comment Actions For normal captures, variables are safe to eliminate if they are non-ODR used or totally unused. However for init captures, non-ODR usage still depends on the capture; they are only safe to eliminate if totally unused. This revision is now accepted and ready to land.Jun 13 2017, 3:55 AM Closed by commit rL305315: Fix spurious Wunused-lambda-capture warning (authored by kongyi). · Explain WhyJun 13 2017, 11:39 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 102099 lib/Sema/SemaLambda.cpp
test/SemaCXX/warn-unused-lambda-capture.cpp
|
This would be better using a ternary operator.
Add a comment too.