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

            Bug ID: 106791
           Summary: [12 Regression] Operator Lookup with using namespace
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at hazardy dot de
  Target Milestone: ---

My Catch Testprojects fail with GCC 12, some in a namespace provided
equality-operators which are brought into the gobal namespace with "using
namespace" are not found anymore.

I have narrowed down to: https://godbolt.org/z/GqnvYMGYq
I was not able to narrow it down without using Catch.
If you define WorkAround it compiles with GCC 11 and 12.

#include <catch.hpp>

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

TEST_CASE("") {
    Type1 t1;
    Type2 t2;

    CHECK(t1 == t2);
}

Reply via email to