On Wed, Jun 11, 2008 at 04:12:18PM +0200, Volker Reichelt wrote:
> * Scopes in for-loops:
> 
>   void foo()
>   {
>     for (int i=0; i<10; ++i) {}
>     i = 0;
>   }
> 
>   warn.cc: In function 'void foo()':
>   warn.cc:4: warning: name lookup of 'i' changed for new ISO 'for' scoping
>   warn.cc:3: warning:   using obsolete binding at 'i'
> 
>   Btw, because the compiler tries to be smart to track new scoping and old
>   scoping at once it rejects valid code, accepts invalid code and even
>   generates wrong code in some cases (see PR10852).

That was originally there because, around the time the standard was
first adopted, there was a lot of old code that used the original
cfront scoping rule.  But people have had a decade now to get their
code right.  It might even be better to toss the support for the
alternative parsing entirely, so the compiler just reports the final
use of i as a reference to an undefined symbol.

Reply via email to