mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-14 03:25:54 +00:00
The fix adds a guard: when d.k == locExpr and the destination type differs from the constructor type (inheritance/subtyping), a temporary is still used so that genAssignment can perform the proper type-tag and slicing checks.
This commit is contained in:
@@ -1893,6 +1893,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||
var useTemp =
|
||||
isRef or
|
||||
(d.k notin {locTemp,locLocalVar,locGlobalVar,locParam,locField,locExpr}) or
|
||||
(d.k == locExpr and d.lode.typ != nil and not sameType(d.lode.typ.skipTypes(abstractInst), t)) or
|
||||
(isPartOf(d.lode, e) != arNo)
|
||||
|
||||
var tmp: TLoc = default(TLoc)
|
||||
|
||||
Reference in New Issue
Block a user