As correctly pointed out by
Griff, your code doesn't compile.
The following one
#include <iostream>
using namespace std;
int x = 19;
int main()
{
int x = 21;
{
int x = 42;
cout << ::x << ", " << x << ", " << ::x << "\n";
}
return 0;
}
makes the compiler complain a bit
warning: unused variable ‘x’ [-Wunused-variable]
7 | int x = 21;
however it compiles and runs, producing the (expected) output
19, 42, 19