Bug 24882 – COM class is allocated using GC not malloc

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2024-11-26T01:58:43Z
Last change time
2024-11-29T13:18:45Z
Keywords
pull
Assigned to
No Owner
Creator
Richard (Rikki) Andrew Cattermole

Comments

Comment #0 by alphaglosined — 2024-11-26T01:58:43Z
When ``_d_newclassT`` was templified, the COM support was regressed. Previously it would allocate using malloc, now it allocates using the GC. https://github.com/dlang/dmd/blob/f1adbd18a2fe262ee7474193383ea579f09e794e/druntime/src/core/lifetime.d#L2742 The reason for this regression is the gate for determining if a class is a COM class. Previously it used the TypeInfo flag. https://github.com/dlang/dmd/blob/1317ba12e242c1fffa76d1cb5e1a405745f89021/druntime/src/rt/lifetime.d#L92 COM classes have the linkage D, but are actually C++ classes in ABI. Due to this they cannot be checked by the linkage, and changing this would either result in a lie, or not be a useful distinction here. My suggestion is to add a new trait ``isCOMClass``, it needs to read the field ``com`` and return that from the class declaration.
Comment #1 by dlang-bot — 2024-11-26T04:10:55Z
@rikkimax created dlang/dmd pull request #17095 "Fix bugzilla issue 24882 - COM class is allocated using GC not malloc" fixing this issue: - Fix bugzilla issue 24882 - COM class is allocated using GC not malloc https://github.com/dlang/dmd/pull/17095
Comment #2 by dlang-bot — 2024-11-29T07:37:14Z
dlang/dmd pull request #17095 "Fix bugzilla issue 24882 - COM class is allocated using GC not malloc" was merged into stable: - cc21a03174dc2fb627442ca201a1f0ed9d18a9bc by Richard (Rikki) Andrew Cattermole: Fix bugzilla issue 24882 - COM class is allocated using GC not malloc https://github.com/dlang/dmd/pull/17095
Comment #3 by dlang-bot — 2024-11-29T13:18:45Z
dlang/dmd pull request #17098 "Merge stable" was merged into master: - 6567f6f4a4a6ad95da1a340e12b1f1130a5a10c0 by Richard (Rikki) Andrew Cattermole: Fix bugzilla issue 24882 - COM class is allocated using GC not malloc https://github.com/dlang/dmd/pull/17098