[Issue 20082] New: Struct with extern destructor that's never called causes link error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 25 07:43:00 UTC 2019


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

          Issue ID: 20082
           Summary: Struct with extern destructor that's never called
                    causes link error
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

test.d
------

struct S
{
    ~this();
}

------

Compile with windows DMD, eg: dmd -m64 -main test.d

Get:
  test.obj : error LNK2001: unresolved external symbol _D4test1S6__dtorMFZv
  test.exe : fatal error LNK1120: 1 unresolved externals


If build `-m32`, no problem.
If you change `~this()` to `this(int)`, no problem.
If you change `~this()` to `void fun()`, no problem.

Something special about the destructor causes this link error, even though the
function is never referenced.

This is blocking std::string, std::vector, it's impossible to build druntime.

--


More information about the Digitalmars-d-bugs mailing list