According to ISO/IEC 14882 6.4-3, the following snippet is ill-formed: if (int x = 1) { int x = 2; // redeclaration of x }
Yet the g++ versions that come with Fedora Core 3 accept it. Specifically, these versions are: gcc version 3.3.4 20040817 (Red Hat Linux 3.3.4-2) gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) gcc version 4.0.0 20041019 (Red Hat 4.0.0-0.8) -- Summary: g++ accepts invalid code Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: seefeld at sympatico dot ca CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: GNU/Linux x86 GCC host triplet: GNU/Linux x86 GCC target triplet: GNU/Linux x86 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18770