Compiler Error C2608

illegal reference cast - operand not an l-value

The reference could not be cast.

This error occurs when a temporary copy of the referenced value cannot be generated.

The following is an example of this error:

struct C
{
   int mem;
   operator int();
};
struct D
{
   operator C();
   void memfunc();
};
D aD[10];
void D::memfunc()
{
   C aC = ( C& )( aD + 1 );   // error
}