www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19158] New: declaration is already defined in another scope

https://issues.dlang.org/show_bug.cgi?id=19158

          Issue ID: 19158
           Summary: declaration is already defined in another scope in
                    main at line
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ali.akhtarzada gmail.com

void main()
{
    {
        struct S {}
    }
    {
        struct S {}
    }
}

Produces

onlineapp.d(8): Error: declaration onlineapp.main.S is already defined in
another scope in main at line 5

It should be possible to do this as they are in different scopes and should've
be different than declaring a variable in different scopes.

Issue 18266 was resolved but only "half" fixed - i.e. the ICE part. So I'm
creating this one to keep track of the other half of that issue.

--
Aug 11 2018