name shadowing in if statement

BCS fubar at pathlink.com
Sat Oct 7 14:18:58 PDT 2006


I think I saw something about this one but I couldn't find the post.

<code>
import std.stdio;

void main()
{
   int i = 1;

   if(int i = i)// new "i" shadows old "i"
   {
       i=6;
       witef("i=",i,\n);
   }
   witef("i=",i,\n);
}
</code>

<output>
i=6
i=1
</output>



More information about the Digitalmars-d-bugs mailing list