Udostępnij za pośrednictwem


Compiler Warning (level 1) C4928

illegal copy-initialization; more than one user-defined conversion has been implicitly applied

More than one user-defined conversion routine was found. The compiler executed the code in all such routines.

This warning is off by default. See Compiler Warnings That Are Off by Default for more information.

The following sample generates C4928:

// C4928.cpp
// compile with: /W1
#pragma warning(default: 4928)

struct I
{
};

struct I1 : I
{
};

struct I2 : I
{
};

template <class T>
struct Ptr
{
   operator T*()
   {
      return 0;
   }

   Ptr()
   {
   }

   Ptr(I*)
   {
   }
};

int main()
{
   Ptr<I1> p1;
   Ptr<I2> p2 = p1;   // C4928
   // try one of the following two lines to resolve this error
   // Ptr<I2> p2(p1);
   // Ptr<I2> p2 = (I1*) p1;
}