Export (0) Print
Expand All
Expand Minimize

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);
}

Community Additions

ADD
Show:
© 2014 Microsoft