https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116866
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >We could add [[nodiscard]] to the class declaration, but I think that doesn't >actually work with gcc right now (it doesn't warn when it should) That would be PR 85973 .