The following code gives an error when compiled without any options: $ g++ bug.cc bug.cc: In function `int main()': bug.cc:14: error: name lookup of `i' changed for new ISO `for' scoping bug.cc:8: error: using obsolete binding at `i' The preprocessed code: # 1 "bug.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "bug.cc" namespace foo { int i; } int main() { for (int i=0; i<=10; ++i) { } { using namespace foo; i = 5; } } Since at the point of assignment, there is an accessible i (namely foo::i), it should be used instead of trying to access the for loop variable (which isn't in scope any more, as the error message correctly points out). Configured with: ./configure --prefix=/psi/gcc-3.3
This is a dup of bug 10852. *** This bug has been marked as a duplicate of 10852 ***