#include <iostream> namespace { bool foo = false; } bool foo = true; int main() { std::cout << foo << std::endl; }
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:12:15: error: reference to ‘foo’ is ambiguous std::cout << foo << std::endl; ^ prog.cpp:8:6: note: candidates are: bool foo bool foo = true; ^ prog.cpp:5:7: note: bool {anonymous}::foo bool foo = false; ^ prog.cpp: At global scope: prog.cpp:5:7: warning: ‘{anonymous}::foo’ defined but not used [-Wunused-variable]
Standard output is empty