[PATCH] D32207: Corrrect warn_unused_result attribute
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 19 12:36:28 PDT 2017
aaron.ballman added a comment.
I'm surprised this change didn't cause any other tests to need to be updated. A few small formatting nits and a request for another test, but otherwise looking good.
================
Comment at: test/SemaCXX/warn-unused-result.cpp:166
+// C++ Methods should warn even in their own class.
+struct[[clang::warn_unused_result]] S {
+ S DoThing() { return {}; };
----------------
Add a space between `struct` and the attribute introducer.
================
Comment at: test/SemaCXX/warn-unused-result.cpp:175
+
+struct[[clang::warn_unused_result]] P {
+ P DoThing() { return {}; };
----------------
Same here.
================
Comment at: test/SemaCXX/warn-unused-result.cpp:200
+ --p; // expected-warning {{ignoring return value}}
+}
+} // namespace
----------------
Can you add some tests showing that casting to void still silence the diagnostic even for these operator cases? It doesn't need to happen for all of them, but it's good to ensure that still behaves as expected.
https://reviews.llvm.org/D32207
More information about the cfe-commits
mailing list