Compiler Error C2681
TOC
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error C2681

'type' : invalid expression type for name

A casting operator tried 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.

Example

// C2681.cpp
class A { virtual void f(); };

void g(int i)
{
    A* pa;
    pa = dynamic_cast<A*>(i);  // C2681
}
Show:
© 2016 Microsoft