mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
properly codegen structs on deref [backport:2.2] (#25600)
Follows up #25269, refs #25265. I hit the same bug as #25265 for my own project but #25269 does not fix it, I think because the type in my case is a `tyGenericInst` which does not trigger the generation here. First I thought of skipping abstract type kinds instead of checking for a raw `tyObject`, which fixes my problem. But in general this could maybe also be encountered for `tyTuple` and `tySequence` etc. So I figured it might just be safest to not filter on specific type kinds, ~~which is done now~~ (edit: broke CI). Maybe this has a slight cost on codegen performance though. Edit: Allowing all types failed CI for some reason as commented below, trying skipped type version again.
This commit is contained in:
@@ -922,8 +922,8 @@ proc genDeref(p: BProc, e: PNode, d: var TLoc) =
|
||||
else:
|
||||
a = initLocExprSingleUse(p, e[0])
|
||||
|
||||
if e.typ != nil and e.typ.kind == tyObject:
|
||||
# bug #23453 #25265
|
||||
# bug #23453 #25265
|
||||
if e.typ != nil and e.typ.skipTypes(abstractInst).kind == tyObject:
|
||||
discard getTypeDesc(p.module, e.typ)
|
||||
if d.k == locNone:
|
||||
# dest = *a; <-- We do not know that 'dest' is on the heap!
|
||||
|
||||
Reference in New Issue
Block a user