[Bug c++/114104] nodiscard not diagnosed on synthesized operator!=

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Feb 25 23:34:36 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114104

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't care whether GCC synthesizes an operator!= that inherits the nodiscard
attribute, or it generates a discarded bool using the built-in !, but there
needs to be a warning either way.

Currently a handwritten operator!= with the attribute gives better results than
letting the compiler do it, and that should not be the case.


More information about the Gcc-bugs mailing list