Skip to content

[REG master] Can't use C++ new/delete with UCRT MinGW fallback #23813

Description

@tim-dlang

Compiling a program using C++ new/delete results in linker failures for DMD nightly (2026-09-08) for Windows using wine under Linux:

import core.stdcpp.new_;
extern(C++) class C
{
    ~this(){}
}

void main()
{
    auto obj = cpp_new!C;
    cpp_delete(obj);
}

Compiling it with wine dmd test.d legacy_stdio_definitions.lib results in:

Unrecognised C++ runtime library 'ucrtbase'
lld-link: error: undefined symbol: void * __cdecl operator new(unsigned __int64)
>>> referenced by test.obj:(_D4core6stdcpp4new___T7cpp_newTC4test1CZQsFNiZQp)

lld-link: error: undefined symbol: void __cdecl operator delete(void *)
>>> referenced by test.obj:(_D4core6stdcpp4new___T10cpp_deleteTC4test1CZQwFQmZv)
Error: linker exited with status 1
       Z:\opt\dmd2-nightly-windows-2026-09-08\windows\bin64\lld-link.exe /NOLOGO "test.obj"   /DEFAULTLIB:"legacy_stdio_definitions.li
b" /DEFAULTLIB:phobos64 vcruntime140.lib  /LIBPATH:"Z:\opt\dmd2-nightly-windows-2026-09-08\windows\bin64\..\lib64\mingw"

The first output line is a pragma(msg) from druntime core/stdcpp/xutility.d.

I think this could be caused by PR #23345, but did not check.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions