https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88738
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- I can see how applying the attribute to every standard library function, even const, might be excessive, but I wonder if it would make sense for the majority of them, or at least for most equality and relational operators defined by the library. If it did we could have GCC apply it implicitly to all such functions or operators defined in namespace std, and provide a new attribute to disable it in the cases where it might not be appropriate (say no_warn_unused_result). We could also add a #pragma to control the scope where the attribute should or should not be implicitly applied to such functions. If you think this might be a worthwhile approach to consider let's schedule it as an enhancement for GCC 10.