This is an archive of the discontinued LLVM Phabricator instance.

Fix nodiscard for volatile references
ClosedPublic

Authored by erichkeane on Oct 18 2017, 3:05 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

erichkeane created this revision.Oct 18 2017, 3:05 PM
aaron.ballman added inline comments.Oct 18 2017, 3:30 PM
lib/AST/Expr.cpp
2302 ↗(On Diff #119528)

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?
}
erichkeane added inline comments.Oct 18 2017, 3:50 PM
lib/AST/Expr.cpp
2302 ↗(On Diff #119528)

I added this test, and it seems to work correctly. Patch with additional test incoming.

Added function-pointer test.

This revision is now accepted and ready to land.Oct 19 2017, 8:14 AM
This revision was automatically updated to reflect the committed changes.