"ahelm at gmx dot net" <[EMAIL PROTECTED]> writes: | C++ standard quote: | | 3.3.2, paragraph 4: | Names declared in the for-init-statement, and in the condition of if, while, | for, and switch statements are local to the if, while, for, or switch statement | (including the controlled statement), and shall not be re-declared in a | subsequent condition of that statement nor in the outermost block (or, for the | if statement, any of the outermost blocks) of the controlled statement; see 6.4. | | However g++/gcc happily compiles: | | #include <stdio.h> | | int main(void) | { | for(int i=2;i<4;i++) | { | int j = i; | int i;
There is duplicate of this bug in the case of C++, see PR2288.