https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106791

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a valid testcase for a GCC bug report. As requested when creating
the bug, please read https://gcc.gnu.org/bugs and provide the missing info next
time.

The example can be reduced to:

namespace test
{
  template<class T, class U>
    bool checkEqual(const T& t, const U& u)
    {
      return t == u;
    }
}

struct Type1 {};

struct Type2 {};

namespace Op {
    bool operator==(const Type1&, const Type2&);
}

//#define WorkAround
#ifndef WorkAround
using namespace Op;
#else
bool operator==(const Type1& t1, const Type2& t2) {
    return Op::operator==(t1, t2);
}
#endif

bool fixture()
{
  Type1 t1;
  Type2 t2;

  return test::checkEqual(t1, t2);
}

GCC is correct to reject this. GCC 11 and older releases had a bug in name
lookup for operators, which has been fixed. See PR51577 for more info.

Clang also rejects your code, with a similar error.

Reply via email to