[Bug c++/61229] warn_unused_result fails to work with member functions
thomas.huxhorn at web dot de
gcc-bugzilla@gcc.gnu.org
Mon Feb 2 14:33:00 GMT 2015
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 :/
More information about the Gcc-bugs
mailing list