[Issue 4889] New: Declarator in "if" statement allows name shadowing

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 18 13:25:30 PDT 2010


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

           Summary: Declarator in "if" statement allows name shadowing
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomash.brechko at gmail.com


--- Comment #0 from Tomash Brechko <tomash.brechko at gmail.com> 2010-09-18 13:24:55 PDT ---
The following compiles without error with dmd 2.049:

void
main()
{
  int i = 1;
  if (int i = 2)
    {
      assert(i == 2);
    }
  assert(i == 1);
}

It seems prohibiting such shadowing would be in line with block shadowing
rules.

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