Compiler Error C2681

'type' : invalid expression type for name

An attempt was made to use a casting operator to convert from an invalid type. For example, if you use the dynamic_cast operator to convert an expression to a pointer type, the source expression must be a pointer.

The following is an example of this error:

class A { virtual void f(); };

void g(int i)
{
    A* pa;
    pa = dynamic_cast<A*>(i);  // error
}