https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100285
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:fb7ca13de4b6d267960fb2c51092343a9e731f66 commit r11-8912-gfb7ca13de4b6d267960fb2c51092343a9e731f66 Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue Apr 27 11:07:47 2021 +0100 libstdc++: Define net::socket_base::message_flags operators as friends [PR 100285] The overloaded operators for socket_base::message_flags should only be defined when the message_flags type itself is defined. Rather than duplicate the preprocessor conditional, this moves the operators into the same scope as the type, defining them as hidden friends. As well as fixing the bug, this has all the usual advantages of hidden friends (they are not visible to normal name lookup for unrelated types). For consistency, do the same for the resolver_base::flags bitmask operators too. libstdc++-v3/ChangeLog: PR libstdc++/100285 * include/experimental/internet (resolver_base::flags): Define overloaded operators as hidden friends. * include/experimental/socket (socket_base::message_flags): Likewise. (cherry picked from commit 8aadb4fedb17e7a44583a7a5a4e96b1874e1ce98)