Compiler Error C2246
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C2246.
identifier' : illegal static data member in locally defined class
A member of a class, structure, or union with local scope is declared static.
The following sample generates C2246:
// C2246.cpp
// compile with: /c
void func( void ) {
class A { static int i; }; // C2246 i is local to func
static int j; // OK
};
Show: