[LLVMbugs] [Bug 8087] New: operator overloading for enums is ambiguous

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 5 09:43:08 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8087

           Summary: operator overloading for enums is ambiguous
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pip88nl at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Clang rejects the following code:

// BEGIN
enum E {
  one
};

bool operator >= (E, E) {
  return 0;
}

int main () {
  E a = one, b = one;
  a >= b; // ambiguous here
}
// END


with an ambiguity error. This is true for revision 112476 and release 2.7.

According to the C++ standard 13.6.1:  If there is a user-written candidate
withthe same name and parameter types as a built-in candidate operator
function, the built-in operator function is hidden and is not included in the
set of candidate functions.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list