Unable to Intialize Enum Class Types | Visual C++

141 views Asked by At

Consider an enum class

enum class FOO
{
  A,B,C
};

struct something
{
  FOO abc = FOO::A; //Compiler Doesnt like this
}

int main(){
  something _something;
  return 0;
}

So the compiler doesnt like the initialisation and gives me 3 different errors.

Error C2238 unexpected token(s) preceding ';'

Error C2059 syntax error: '='

Error C2653 'FOO': is not a class or namespace name


Compiler:

Visual C++

Build Tools MsVC142

So am I initialisation the enum incorrectly? or am i completely missing something.

0

There are 0 answers