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: [email protected]
Reporter: [email protected]
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.
--