fork(2) download
  1. #include <stdint.h>
  2.  
  3. class C64 {
  4.  
  5. uint64_t Value;
  6.  
  7. public:
  8.  
  9. C64 () : Value (0) { }
  10.  
  11. operator uint64_t () const { return Value; }
  12. operator int64_t () const { return Value; }
  13. void operator = (uint64_t S) { Value = S; }
  14. void operator = (int64_t S) { Value = S; }
  15.  
  16. };
  17.  
  18. void f () {
  19.  
  20. C64 c;
  21.  
  22. int i = 0;
  23. unsigned int ui = 0;
  24.  
  25. bool b = (c == 0);
  26.  
  27. c = i;
  28. c = ui;
  29.  
  30. }
  31.  
  32. int main() {
  33. f();
  34. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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; }
        ^~~~~~~~
stdout
Standard output is empty