https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61229
Thomas Huxhorn <thomas.huxhorn at web dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thomas.huxhorn at web dot de --- Comment #3 from Thomas Huxhorn <thomas.huxhorn at web dot de> --- Here is another one: class C { public: ~C() {} // comment out to trigger warning at c.noWarning() int giveWarning() __attribute__((warn_unused_result)) { return 0; } C noWarning() __attribute__((warn_unused_result)) { return C(); } }; int main() { C c; c.giveWarning(); c.noWarning(); return 0; } A workaround for me is to delete the empty deconstrcutor. But thats not always possible :/