fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. auto func(T) -> void
  6. {
  7. cout << "::f" << endl;
  8. }
  9.  
  10. namespace my_ns {
  11. struct my_struct {};
  12.  
  13. auto func(my_struct) -> void
  14. {
  15. cout << "my_ns::func" << endl;
  16. }
  17.  
  18. auto another_func() -> void
  19. {
  20. // won't compile without `using ::func;`
  21. func(123);
  22. }
  23. }
  24.  
  25. auto main() -> int {}
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void my_ns::another_func()’:
prog.cpp:21:17: error: could not convert ‘123’ from ‘int’ to ‘my_ns::my_struct’
         func(123);
                 ^
stdout
Standard output is empty