fork download
  1. #include <iostream>
  2.  
  3. namespace N {
  4.  
  5. class C;
  6. int f(const C&);
  7.  
  8. class C {
  9. public:
  10. friend int f(const C& c)
  11. {
  12. std::cout << __PRETTY_FUNCTION__ << '\n';
  13. return 1;
  14. }
  15.  
  16. friend int g(const C& c)
  17. {
  18. std::cout << __PRETTY_FUNCTION__ << '\n';
  19. return 2;
  20. }
  21. };
  22.  
  23. class D {
  24. public:
  25. void f()
  26. {
  27. g(C{}); //ADL finds this
  28. N::f(C{}); //not found dispite full qualification
  29. }
  30. };
  31. }
  32.  
  33. int main()
  34. {
  35. N::D d;
  36. d.f();
  37. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
int N::g(const N::C&)
int N::f(const N::C&)