Compiler Error C2070
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 C2070

Error Message

'type': illegal sizeof operand

The sizeof operator requires an expression or type name.

The following sample generates C2070:

// C2070.cpp
void func() {}
int main() {
   int a;
   a = sizeof(func);   // C2070
}

Possible resolution:

// C2070b.cpp
void func() {}
int main() {
   int a;
   a = sizeof(a);
}
Show:
© 2016 Microsoft