This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/51454] New: For loop improper scoping


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51454

             Bug #: 51454
           Summary: For loop improper scoping
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pubby.8@gmail.com


gcc version 4.7.0 20111203 (experimental) (GCC) 

This worked on 4.6, but isn't on 4.7:

for(float x = 0.0f; int x = 0;); 

error: redeclaration of âint xâ
error: âfloat xâ previously declared here

It should be equivalent to this which compiles correctly:

{
  float x = 0.0f;
  while (int x = 0) { ; }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]