[cfe-commits] r56060 - /cfe/trunk/lib/Parse/ParseStmt.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Thu Sep 11 15:22:43 PDT 2008
Neil Booth wrote:
> Argiris Kirtzidis wrote:-
>
>
>> I think this is more explicit:
>>
>> // C++ 3.3.2p4:
>> // 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).
>>
>> Should I replace the "C++ 6.4p3" quote, with the above one ?
>>
>
> I don't think it adds anything - it doesn't say a new scope is
> created.
>
But it says that for your example:
void f(void)
{
int x; #1
if (int x = 1) #2
{
}
}
#2 is local to the if statement, so it doesn't collide with #1.
3.3.2p4 says that #2 is local to the if statement, and 6.4p3 says that #2 goes out of scope when the if statement finishes.
Are you suggesting that we handle these requirements for #2 without entering a new scope ?
-Argiris
More information about the cfe-commits
mailing list