www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9161] New: Linker error on linux if struct has disabled ~this();

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


--- Comment #0 from Dmitry Olshansky <dmitry.olsh 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: -------
Dec 15 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9161


David Nadlinger <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code klickverbot.at


--- Comment #1 from David Nadlinger <code klickverbot.at> 2012-12-15 08:31:39
PST ---
Shouldn't we just emit a null pointer into the struct TypeInfo for disabled
dtors?

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



--- Comment #2 from Dmitry Olshansky <dmitry.olsh gmail.com> 2012-12-22
13:05:17 PST ---
(In reply to comment #1)
 Shouldn't we just emit a null pointer into the struct TypeInfo for disabled
 dtors?
I do think it's the same as disable this(); i.e. changes semantics so that you literally can't call destructor even statically. And on win32 I'm seeing just that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2012