This documentation is archived and is not being maintained.

Compiler Error C2594

Error Message

'operator' : ambiguous conversions from 'type1' to 'type2'

No conversion from type1 to type2 was more direct than any other. One possible solution is to define or specify an explicit conversion.

The following sample generates C2594:

// C2594.cpp
// compile with: /c
struct A{};
struct I1 : A {};
struct I2 : A {};
struct D : I1, I2 {};

A *f (D *p) {
   return (A*) (p);    // C2594

   // try the following line instead
   // return reinterpret_cast<A*> (p);
}
Show: