fork download
  1. #include <iostream>
  2.  
  3. namespace so
  4. {
  5. struct foo { int x; };
  6.  
  7. inline bool do_it(foo const &, foo const &)
  8. {
  9. std::cout << "so" << std::endl;
  10. return (true);
  11. }
  12.  
  13. namespace other
  14. {
  15. inline static bool do_it(so::foo const &, so::foo const &)
  16. {
  17. std::cout << "so::other" << std::endl;
  18. return (true);
  19. }
  20.  
  21. static void somefunc(so::foo const & a, so::foo const & b)
  22. {
  23. do_it(a, b);
  24. }
  25. }
  26.  
  27. }
  28.  
  29. int main()
  30. {
  31. so::foo a_, b_;
  32.  
  33. so::other::somefunc(a_, b_);
  34.  
  35. return (0);
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void so::other::somefunc(const so::foo&, const so::foo&)’:
prog.cpp:23:12: error: call of overloaded ‘do_it(const so::foo&, const so::foo&)’ is ambiguous
  do_it(a, b);
            ^
prog.cpp:23:12: note: candidates are:
prog.cpp:15:20: note: bool so::other::do_it(const so::foo&, const so::foo&)
 inline static bool do_it(so::foo const &, so::foo const &)
                    ^
prog.cpp:7:13: note: bool so::do_it(const so::foo&, const so::foo&)
 inline bool do_it(foo const &, foo const &)
             ^
stdout
Standard output is empty