[PATCH] D39075: Fix nodiscard for volatile references

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 15:30:27 PDT 2017


aaron.ballman added inline comments.


================
Comment at: lib/AST/Expr.cpp:2302
+              cast<VarDecl>(DRE->getDecl())->hasLocalStorage()) &&
+            !isa<CallExpr>(CE->getSubExpr()->IgnoreParens())) {
           return CE->getSubExpr()->isUnusedResultAWarning(WarnE, Loc,
----------------
Does this properly handle calls through function pointers (which usually have implicit casts)?
```
[[nodiscard]] volatile char &(*fp)();
void g() {
  (void)fp(); // No diagnostic here, either?
}
```


https://reviews.llvm.org/D39075





More information about the cfe-commits mailing list