https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88738
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2019-01-12 CC| |msebor at gcc dot gnu.org Component|c++ |libstdc++ Ever confirmed|0 |1 Severity|normal |enhancement --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Annotating std::operator==(shared_ptr, nullptr_t) with attribute warn_unused_result is enough to give a warning for the test case in comment #0. Handling the test case in comment #1 is a bit more involved because GCC doesn't issue -Wunused-variable warnings for objects of classes with ctors/dtors, so it will likely take a compiler enhancement (say, an attribute to request such warnings for classes whose user-defined ctors and dtors have no side-effects). I've changed the Component to libstdc++ since that's the easy part (and will let the library maintainers more quickly chime in on if it's doable and when).