#include <stdint.h>
class C64 {
uint64_t Value;
public:
C64 () : Value (0) { }
operator uint64_t () const { return Value; }
operator int64_t () const { return Value; }
void operator = (uint64_t S) { Value = S; }
void operator = (int64_t S) { Value = S; }
};
void f () {
C64 c;
int i = 0;
unsigned int ui = 0;
bool b = (c == 0);
c = i;
c = ui;
}
int main() {
f();
}
I2luY2x1ZGUgPHN0ZGludC5oPgoKY2xhc3MgQzY0IHsKCiAgdWludDY0X3QgVmFsdWU7CgogIHB1YmxpYzoKCiAgQzY0ICgpIDogVmFsdWUgKDApIHsgfQoKICBvcGVyYXRvciB1aW50NjRfdCAoKSBjb25zdCB7IHJldHVybiBWYWx1ZTsgfQogIG9wZXJhdG9yIGludDY0X3QgKCkgY29uc3QgeyByZXR1cm4gVmFsdWU7IH0KICB2b2lkIG9wZXJhdG9yID0gKHVpbnQ2NF90IFMpIHsgVmFsdWUgPSBTOyB9CiAgdm9pZCBvcGVyYXRvciA9IChpbnQ2NF90IFMpIHsgVmFsdWUgPSBTOyB9Cgp9OwoKdm9pZCBmICgpIHsKCiAgQzY0IGM7CgogIGludCBpID0gMDsKICB1bnNpZ25lZCBpbnQgdWkgPSAwOwoKICBib29sIGIgPSAoYyA9PSAwKTsKCiAgYyA9IGk7CiAgYyA9IHVpOwoKfQoKaW50IG1haW4oKSB7CglmKCk7Cn0=
prog.cpp: In function ‘void f()’:
prog.cpp:25:15: error: ambiguous overload for ‘operator==’ (operand types are ‘C64’ and ‘int’)
bool b = (c == 0);
~~^~~~
prog.cpp:25:15: note: candidate: operator==(uint64_t {aka long unsigned int}, int) <built-in>
prog.cpp:25:15: note: candidate: operator==(int64_t {aka long int}, int) <built-in>
prog.cpp:27:7: error: ambiguous overload for ‘operator=’ (operand types are ‘C64’ and ‘int’)
c = i;
^
prog.cpp:13:8: note: candidate: void C64::operator=(uint64_t)
void operator = (uint64_t S) { Value = S; }
^~~~~~~~
prog.cpp:14:8: note: candidate: void C64::operator=(int64_t)
void operator = (int64_t S) { Value = S; }
^~~~~~~~
prog.cpp:28:7: error: ambiguous overload for ‘operator=’ (operand types are ‘C64’ and ‘unsigned int’)
c = ui;
^~
prog.cpp:13:8: note: candidate: void C64::operator=(uint64_t)
void operator = (uint64_t S) { Value = S; }
^~~~~~~~
prog.cpp:14:8: note: candidate: void C64::operator=(int64_t)
void operator = (int64_t S) { Value = S; }
^~~~~~~~