www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3031] New: scoped static var conflicts while linking

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3031

           Summary: scoped static var conflicts while linking
           Product: D
           Version: 2.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


void func(int i)
{
    switch(i)
    {
        case 1:{static int j;break;}
        case 2:{static int j;break;}
    }
}

void main()
{
}

compile this you get the previous definition different error when you link it.


 Error 1: Previous Definition Different : _D4test4funcFiZv1ji

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 27 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3031


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m
         OS/Version|Windows                     |All



12:39:50 PDT ---
Simpler test case:

----

void main()
{
    { static int foo; }
    { static int foo; }
}

$ rdmd test.d
ld: duplicate symbol _D4test4mainFZv3fooi in
/tmp/.rdmd/rdmd-test.d-801BCEFE1CAD8F2472CC2713A3BF5714/test.d.o and
/tmp/.rdmd/rdmd-test.d-801BCEFE1CAD8F2472CC2713A3BF5714/test.d.o
collect2: ld returned 1 exit status

----

Unfortunately I'm not sure whether this is supposed to be an error or not.
Obviously D doesn't consider scope for the mangled names of static local
variables, but if this is meant to be an error then it should be a compiler
error, not linker error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 23 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3031




PST ---
Created an attachment (id=817)
Fix for this bug.

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


Lukasz Wrzosek <luk.wrzosek gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------

           obsolete|                            |



PST ---
Created an attachment (id=819)
Once again fix added and marked (patch)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3031


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



13:37:50 PST ---
Pull request and more commentary:

https://github.com/D-Programming-Language/dmd/pull/721

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3031


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch, wrong-code           |link-failure
                 CC|                            |yebblies gmail.com
           Platform|x86                         |All
            Version|2.028                       |D1 & D2



Issue 5655 is the same sort of thing for lambdas.

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