Is it well defined to access a variable from an outer scope before it is redefined?
This code compiles with no warnings in gcc-11: int i{ 2 }; { std::cout << i; //prints 2 int i{ 3 }; std::cout << i; //prints 3 } Is this well defined or it just happened to work? >Solution : Is this well defined or it just happened to work? It is well-defined. The scope… Read More Is it well defined to access a variable from an outer scope before it is redefined?