[Issue 9161] New: Linker error on linux if struct has @disabled ~this();

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 15 08:17:23 PST 2012


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

           Summary: Linker error on linux if struct has @disabled ~this();
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dmitry.olsh at gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-12-15 08:17:16 PST ---
The intent here is to agressively prevent people from using struct that is only
meant as a namespace and thus contains only static methods & opCall/opDispatch
etc.

The sample below with fine on Win32 but fails to link on Linux 64-bit:

public struct dummy
{    
    static auto opCall(C)(in C[] name)
    {
        return name;       
    }

    @disable ~this(); //comment this out to avoid error
}

void main()
{
    assert(dummy("ABCDE") == "ABCDE");
}

The error message is:

test_case.o:(.data._D26TypeInfo_S9test_case5dummy6__initZ+0x58): undefined
reference to `_D9test_case5dummy6__dtorMFZv'

That is the destructor symbol is not found - correct it shouldn't been there,
but apparently it's referenced all the same.

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