fork download
  1. typedef unsigned int flag;
  2.  
  3. enum stupid_idea
  4. {
  5. optimize = 0,
  6. normal = 0,
  7. something = 1,
  8. };
  9.  
  10. // HOW DO I CALL THIS WITH optimize
  11. int x(const char *text, flag f = normal)
  12. {
  13. return 5;
  14. }
  15.  
  16. int x(const char *text, const char *text2, flag f = normal)
  17. {
  18. return 5;
  19. }
  20.  
  21. int main()
  22. {
  23. x("hello", 0);
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:23:17: error: call of overloaded ‘x(const char [6], int)’ is ambiguous
prog.cpp:23:17: note: candidates are:
prog.cpp:11:5: note: int x(const char*, flag)
prog.cpp:16:5: note: int x(const char*, const char*, flag)
stdout
Standard output is empty