Thread overview
[Issue 9172] New: strange shadowing declaration check
Dec 17, 2012
Alexander Tankeev
Dec 17, 2012
Alexander Tankeev
Dec 17, 2012
Alexander Tankeev
December 17, 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@puremagic.com
        ReportedBy: atankeev@gmail.com


--- Comment #0 from Alexander Tankeev <atankeev@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: -------
December 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9172


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2012-12-17 13:09:30 PST ---
It's a dangling else. Always compile with -w or -wi. This issue should be closed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9172


Alexander Tankeev <atankeev@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #2 from Alexander Tankeev <atankeev@gmail.com> 2012-12-17 13:14:46 PST ---
Oops. My bad, sorry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9172


Alexander Tankeev <atankeev@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 26, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9172


Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |RESOLVED
                 CC|                            |andrei@erdani.com


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