Jump to case label crosses initialization of 'Foo foo'
From Cppsyntax
According to this, you have to use { } inside a case statement when declaring variables.
WRONG
switch(typ) {
case 1:
MyClass* class = new MyClass();
...
case 2:
}
CORRECT
switch(typ) {
case 1: {
MyClass* class = new MyClass();
...
}
case 2:
}
