[PATCH] D30327: [Sema] Improve side effect checking for unused-lambda-capture warning

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 11:51:37 PST 2017


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaLambda.cpp:1458
+
+  return false;
+}
----------------
I think this is missing one more case: capturing a `volatile` variable by copy does have a side effect in that the variable is read when the capture occurs. e.g., this should not diagnose either:
```
void f(volatile int v) {
  [v]{}();
}
```


https://reviews.llvm.org/D30327





More information about the cfe-commits mailing list