[LLVMbugs] [Bug 8530] New: Clang rejects enum comparison operators

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 2 05:11:10 PDT 2010


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

           Summary: Clang rejects enum comparison operators
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mikazkow at tlen.pl
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


This is similar to #7319, but there it was a templated operator.

Source:

enum A{X,Y};
bool operator<(A,A);
int main() {
 return X<Y;
}

Result:
<stdin>:4:10: error: use of overloaded operator '<' is ambiguous
 return X<Y;
        ~^~
<stdin>:2:6: note: candidate function
bool operator<(A,A);
     ^
<stdin>:4:10: note: built-in candidate operator<(enum A, enum A)
 return X<Y;
         ^
<stdin>:4:10: note: built-in candidate operator<(int, int)
<stdin>:4:10: note: built-in candidate operator<(double, int)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, int)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, int)
<stdin>:4:10: note: built-in candidate operator<(long double, int)
<stdin>:4:10: note: built-in candidate operator<(long long, int)
<stdin>:4:10: note: built-in candidate operator<(float, int)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, int)
<stdin>:4:10: note: built-in candidate operator<(long, int)
<stdin>:4:10: note: built-in candidate operator<(int, long)
<stdin>:4:10: note: built-in candidate operator<(int, long long)
<stdin>:4:10: note: built-in candidate operator<(int, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(int, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(int, unsigned long long)
<stdin>:4:10: note: built-in candidate operator<(int, float)
<stdin>:4:10: note: built-in candidate operator<(int, double)
<stdin>:4:10: note: built-in candidate operator<(int, long double)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, double)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, long
double)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, float)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, unsigned
long long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, unsigned
long)
<stdin>:4:10: note: built-in candidate operator<(float, long)
<stdin>:4:10: note: built-in candidate operator<(float, long long)
<stdin>:4:10: note: built-in candidate operator<(float, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(float, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(float, unsigned long long)
<stdin>:4:10: note: built-in candidate operator<(float, float)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, unsigned
int)
<stdin>:4:10: note: built-in candidate operator<(float, double)
<stdin>:4:10: note: built-in candidate operator<(long double, long double)
<stdin>:4:10: note: built-in candidate operator<(long double, double)
<stdin>:4:10: note: built-in candidate operator<(long double, float)
<stdin>:4:10: note: built-in candidate operator<(long double, unsigned long
long)
<stdin>:4:10: note: built-in candidate operator<(long double, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(long double, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(long double, long long)
<stdin>:4:10: note: built-in candidate operator<(long double, long)
<stdin>:4:10: note: built-in candidate operator<(double, long double)
<stdin>:4:10: note: built-in candidate operator<(double, double)
<stdin>:4:10: note: built-in candidate operator<(double, float)
<stdin>:4:10: note: built-in candidate operator<(double, unsigned long long)
<stdin>:4:10: note: built-in candidate operator<(double, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(double, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(double, long long)
<stdin>:4:10: note: built-in candidate operator<(double, long)
<stdin>:4:10: note: built-in candidate operator<(float, long double)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, long)
<stdin>:4:10: note: built-in candidate operator<(long long, long double)
<stdin>:4:10: note: built-in candidate operator<(long long, double)
<stdin>:4:10: note: built-in candidate operator<(long long, float)
<stdin>:4:10: note: built-in candidate operator<(long long, unsigned long long)
<stdin>:4:10: note: built-in candidate operator<(long long, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(long long, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(long long, long long)
<stdin>:4:10: note: built-in candidate operator<(long long, long)
<stdin>:4:10: note: built-in candidate operator<(long, long double)
<stdin>:4:10: note: built-in candidate operator<(long, double)
<stdin>:4:10: note: built-in candidate operator<(long, float)
<stdin>:4:10: note: built-in candidate operator<(long, unsigned long long)
<stdin>:4:10: note: built-in candidate operator<(long, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(long, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(long, long long)
<stdin>:4:10: note: built-in candidate operator<(long, long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, long long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long long, long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, long double)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, double)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, float)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, unsigned long
long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, long long)
<stdin>:4:10: note: built-in candidate operator<(unsigned long, long)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, long double)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, double)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, float)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, unsigned long
long)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, unsigned long)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, unsigned int)
<stdin>:4:10: note: built-in candidate operator<(unsigned int, long long)
1 error generated.

-- 
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