Revert "fixes #9940; genericAssign does not take care of the importC variables in refc [backport] (#23761)"

This reverts commit fda43d1f0a.
This commit is contained in:
narimiran
2024-07-09 13:02:30 +02:00
parent d993aff496
commit 9ce81868a8
2 changed files with 1 additions and 29 deletions

View File

@@ -1246,7 +1246,7 @@ proc genObjectInfo(m: BModule, typ, origType: PType, name: Rope; info: TLineInfo
else:
genTypeInfoAuxBase(m, typ, origType, name, rope("0"), info)
var tmp = getNimNode(m)
if (not isImportedType(typ)) or tfCompleteStruct in typ.flags:
if not isImportedType(typ):
genObjectFields(m, typ, origType, typ.n, tmp, info)
m.s[cfsTypeInit3].addf("$1.node = &$2;$n", [tiNameForHcr(m, name), tmp])
var t = typ[0]

View File

@@ -4,7 +4,6 @@ success
M1 M2
ok
'''
matrix: "--mm:refc;--mm:orc"
"""
type
@@ -133,30 +132,3 @@ proc foo = # bug #23280
doAssert L mod 6 == 0
foo()
block: # bug #9940
{.emit:"""/*TYPESECTION*/
typedef struct { int base; } S;
""".}
type S {.importc: "S", completeStruct.} = object
base: cint
proc init(x:ptr S) =
x.base = 1
type
Foo = object
a: seq[float]
b: seq[float]
c: seq[float]
d: seq[float]
s: S
proc newT(): Foo =
var t: Foo
t.s.addr.init
doAssert t.s.base == 1
t
var t = newT()
doAssert t.s.base == 1