This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] LWG 2989 hide path iostream operators from normal lookup
- From: François Dumont <frs dot dumont at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 21 Jun 2018 07:12:09 +0200
- Subject: Re: [PATCH] LWG 2989 hide path iostream operators from normal lookup
- References: <20180618185937.GA21722@redhat.com>
That's a great way to define global operators.
I started working on making iterator operators global as we said once on
this mailing list. I already noticed during that task that when I was
making a mistake and gcc was complaining about not finding the ==
operator it was proposing about 80 candidates, so a very big compiler
error message.
Can I generalize this approach ?
François
On 18/06/2018 20:59, Jonathan Wakely wrote:
By only defining these operators as friends (with no namespace-scope
declaration) they can only be found by ADL and do not participate in
overload resolution for arguments of types other than path.
LWG 2989 hide path iostream operators from normal lookup
* include/bits/fs_path.h (operator<<, operator>>): Define inline as
friends.
* testsuite/27_io/filesystem/path/io/dr2989.cc: New.
Tested powerpc64le-linux, commmitted to trunk.