https://bugs.llvm.org/show_bug.cgi?id=51887

            Bug ID: 51887
           Summary: Unambiguous use of operator==considered ambiguous.
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: qtom.boeh...@googlemail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

The following compiles fine with gcc, but with clang gives the error: "use of
overloaded operator '==' is ambiguous".

----------------------------------------------------
#include <cassert>

template<typename T>
bool operator==(T const&, T const&)
{
        return false;
}

template<int I>
struct S
{
        template<int J>
        constexpr
        bool operator==(S<J> const&) const
        {
                return true;
        }
};

int main()
{
        auto i = S<0>{};
        auto j = S<0>{};

        assert(i == j);
}
----------------------------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to