[Bug c++/100465] Overloading operator+= and including filesystem causes conflicting overload compilation error
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 29 16:38:37 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100465
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to Jonathan Wakely from comment #2)
> > Maybe another case of PR 51577 but I haven't looked into it yet.
>
> The testcase in comment 4 was fixed by the patch for that bug, r12-702.
>
> The original testcase using <filesystem> still fails though.
>
> Patrick, do you think this is just a dup of PR 51577? Do I need to reduce
> this again to something that still fails, or do we have a matching testcase
> already?
r12-702 should have fixed operator lookup in the block scope case, so I'd
expect the original <filesystem> testcase to work since the problematic name
lookup occurs at block scope. I think the other unresolved testcases
associated with PR51577 all have to do with name lookup at non-block scope, so
this seems to be a distinct bug.
Here's a reduced rejects-valid testcase:
namespace N
{
struct string
{
template<typename T>
void operator+=(T);
};
struct A {
void operator+=(char); // #1
template<typename T>
void f() {
string s;
s += T();
}
void g() {
f<char>();
}
};
} // namespace N
template<typename T>
void operator+=(N::string, T);
If we comment out the line #1 then it works.
More information about the Gcc-bugs
mailing list