mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #25236
This commit is contained in:
@@ -1044,6 +1044,8 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||
body.add genBuiltin(c, mWasMoved, "wasMoved", x)
|
||||
else:
|
||||
fillBodyObjT(c, t, body, x, y)
|
||||
elif tfUnion in t.flags: # bug #25236
|
||||
defaultOp(c, t, body, x, y)
|
||||
else:
|
||||
if c.kind == attachedDup:
|
||||
var op2 = getAttachedOp(c.g, t, attachedAsgn)
|
||||
|
||||
@@ -912,3 +912,28 @@ block: # bug #24754
|
||||
NoCopy(id: s)
|
||||
|
||||
doAssert foo().id == 12
|
||||
|
||||
|
||||
type
|
||||
Sinn* {.union.} = object
|
||||
c*: C
|
||||
b*: bool
|
||||
|
||||
Regen* = object
|
||||
case x*: bool
|
||||
of false:
|
||||
a*: Sinn
|
||||
of true:
|
||||
cvar*: RootRef
|
||||
|
||||
C* = enum
|
||||
wrong1, wrong2, right
|
||||
|
||||
proc mainRegen() =
|
||||
var xs: seq[Regen]
|
||||
let a = Regen(x: false, a: Sinn(c: right))
|
||||
var b = a
|
||||
xs.add(a)
|
||||
doAssert b.a.c == right
|
||||
|
||||
mainRegen()
|
||||
|
||||
Reference in New Issue
Block a user