This has nothing to do with statics whatsoever. Your problem can be reproduced with a much smaller piece of code that has no static
variables in it at all.
The compilation error is very clear:
main.cpp: In function 'int main()': main.cpp:12:1: error: jump to label 'b' [-fpermissive] b: ^ main.cpp:9:10: error: from here [-fpermissive] goto b; ^ main.cpp:10:9: error: crosses initialization of 'int b' int b=6; ^
C++ has rules against goto
-jumping across initialisations; this goes hand in hand with its support for classes and objects that are, in general, far more complex than the objects you can create in C.
You should read this post.
0
solved Cannot understand Behaviour of Static In C and C++ [closed]