www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9172] New: strange shadowing declaration check

reply d-bugmail puremagic.com writes:
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



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 }-------


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 }-------


2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9172


bearophile_hugs eml.cc changed:

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



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: -------
Dec 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9172


Alexander Tankeev <atankeev gmail.com> changed:

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



PST ---
Oops. My bad, sorry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
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: -------
Dec 17 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 26 2013