[Issue 9172] New: strange shadowing declaration check

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 17 12:56:48 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9172

           Summary: strange shadowing declaration check
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: atankeev at gmail.com


--- Comment #0 from Alexander Tankeev <atankeev at gmail.com> 2012-12-17 12:56:47 PST ---
DMD64 D Compiler v2.060

---{ testcase.d }---
import std.random;
void main()
{
    if ( uniform(0,1) )
        for(uint i=0; i < 1; i++)
            if ( uniform(0,1) ) {}
    else
        for(uint i=0; i < 1; i++)
            if ( uniform(0,1) ) {}
}
------{ EOF }-------

# rdmd testcase.d
testcase.d(8): Error: shadowing declaration testcase.main.i is deprecated

---{ testcase.d }---
import std.random;
import std.stdio;
void main()
{
    if ( uniform(0,1) )
        for(uint i=0; i < 1; i++)
            writeln(1);//if ( uniform(0,1) ) {}
    else
        for(uint i=0; i < 1; i++)
            writeln(2);//if ( uniform(0,1) ) {}
}
------{ EOF }-------

# rdmd testcase.d
2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list