Revert "fixes #25205 #14873; resets importc obj with nimZeroMem in specializeResetT for refc (#25207)"

This reverts commit 9628c7a4f8.
This commit is contained in:
narimiran
2025-10-08 07:03:51 +02:00
parent 4ed76ff007
commit 2136f349f4
2 changed files with 1 additions and 35 deletions

View File

@@ -66,14 +66,7 @@ proc specializeResetT(p: BProc, accessor: Rope, typ: PType) =
var x = typ.baseClass
if x != nil: x = x.skipTypes(skipPtrs)
specializeResetT(p, accessor.parentObj(p.module), x)
if typ.n != nil:
if typ.sym != nil and sfImportc in typ.sym.flags:
# imported C struct, nimZeroMem
p.s(cpsStmts).addCallStmt(cgsymValue(p.module, "nimZeroMem"),
cCast(ptrType(CPointer), cAddr(accessor)),
cSizeof(getTypeDesc(p.module, typ)))
else:
specializeResetN(p, accessor, typ.n, typ)
if typ.n != nil: specializeResetN(p, accessor, typ.n, typ)
of tyTuple:
let typ = getUniqueType(typ)
for i, a in typ.ikids:

View File

@@ -9,30 +9,3 @@ import std/assertions
var m = createMyType[int]()
doAssert m.use() == 3
import std/locks
type
S = object
r: proc()
B = object
d: Lock
w: S
proc v(x: ptr B) {.exportc.} = reset(x[])
type
Test = object
path: string # Removing this makes both cases work.
lock: Lock
# A: This is not fine.
var a = Test()
proc main(): void =
# B: This is fine.
var b = Test()
main()