We recommend using Visual Studio 2017

Compiler Error C3066

 

The latest version of this topic can be found at Compiler Error C3066.

there are multiple ways that an object of this type can be called with these arguments

The compiler detected an ambiguous function call involving surrogates.

The following sample generates C3066:

// C3066.cpp  
template <class T, class U> void func(T*, U*){}  
  
typedef void (*PF)(const int*, const char*);  
typedef void (*PF1)(const int*, volatile char*);  
  
struct A {  
   operator PF() const {  
      return func;  
   }  
  
   operator PF1() {  
      return func;  
   }  
  
   operator PF1() const  {  
      return func;  
   }  
  
};  
  
int main() {  
   A a;  
   int i;  
   char c;  
  
   a(&i, &c);   // C3066  
   a(&i, (const char *) &c);   // OK  
}  

Show: