http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55798
Bug #: 55798 Summary: suprious redeclaration error in for-loop Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: f.heckenb...@fh-soft.de Created attachment 29035 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29035 Test case The attached example gives the error: foo.cpp: In function 'int main()': foo.cpp:5:11: error: redeclaration of 'int i' foo.cpp:3:12: error: 'int i' previously declared here I don't think that's correct. Even if the variable declared in the for-loop goes into the scope of the loop body, the braces should open a new scope, don't they? FWIW, this error does not occur in C (with "-std=c99").