Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4675

Visual Studio .NET 2003

'function' : resolved overload was found by argument-dependent lookup

A function found by argument-dependent lookup (Koenig lookup) was eventually chosen by overload resolution.

In Visual C++ .NET and earlier compilers, a different function would have been called. To pick the original function, use an explicitly qualified name.

The following sample generates C4675:

// C4675.cpp
// compile with: /W1 /EHsc
#include <iostream>
using namespace std;
namespace NS1
{
   void f(void*, double)
   {
      cout << "NS1::f(void*,double)" << endl;
   }
   void f(char*, char)
   {
      cout << "NS1::f(char*,char)" << endl;
   }
}

namespace NS2
{
   using namespace NS2;
   class T
   {
   };
   void f(T*, float)
   {
      cout << "NS2::f(T*,float)" << endl;
   }
}

int main()
{
   using namespace NS1;
   NS2::T x;
   f(&x, 1.0F);   // C4675
   // try the following line instead
   // NS2::f(&x, 1.0F);
}
Show:
© 2015 Microsoft