fork download
  1. #include <iostream>
  2.  
  3. namespace
  4. {
  5. bool foo = false;
  6. }
  7.  
  8. bool foo = true;
  9.  
  10. int main()
  11. {
  12. std::cout << foo << std::endl;
  13. }
  14.  
  15.  
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
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]
stdout
Standard output is empty