From 2c8551556e5b51b7a7e487b1043b92d4ad34dbf0 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 16 May 2024 02:52:18 +0800 Subject: fixes lifting subtype calling parent's hooks (#23612) ref https://forum.nim-lang.org/t/11587 Tested with `gcc version 14.0.1 20240412` locally --- compiler/liftdestructors.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index 0e3518c5f..f62927cec 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -222,7 +222,10 @@ proc fillBodyObj(c: var TLiftCtx; n, body, x, y: PNode; enforceDefaultOp: bool) proc fillBodyObjTImpl(c: var TLiftCtx; t: PType, body, x, y: PNode) = if t.baseClass != nil: - fillBody(c, skipTypes(t.baseClass, abstractPtrs), body, x, y) + let obj = newNodeIT(nkHiddenSubConv, c.info, t.baseClass) + obj.add newNodeI(nkEmpty, c.info) + obj.add x + fillBody(c, skipTypes(t.baseClass, abstractPtrs), body, obj, y) fillBodyObj(c, t.n, body, x, y, enforceDefaultOp = false) proc fillBodyObjT(c: var TLiftCtx; t: PType, body, x, y: PNode) = -- cgit 1.4.1-2-gfad0