fixes #13481; fixes #22708; disable using union objects in VM (#23362)

fixes #13481;
fixes #22708

Otherwise it gives implicit results or bad codegen
This commit is contained in:
ringabout
2024-03-03 22:56:06 +08:00
committed by GitHub
parent f4fe3af42a
commit 31d7554524
2 changed files with 2 additions and 8 deletions

View File

@@ -2050,6 +2050,8 @@ proc genSetConstr(c: PCtx, n: PNode, dest: var TDest) =
c.freeTemp(a)
proc genObjConstr(c: PCtx, n: PNode, dest: var TDest) =
if tfUnion in n.typ.flags: # bug #22708 # bug #13481
globalError(c.config, n.info, "object with '{.union.}' pragmas is not supported by VM")
if dest < 0: dest = c.getTemp(n.typ)
let t = n.typ.skipTypes(abstractRange+{tyOwned}-{tyTypeDesc})
if t.kind == tyRef:

View File

@@ -301,14 +301,6 @@ block: # bug #10815
const a = P()
doAssert $a == ""
when defined osx: # xxx bug #13481
block:
type CharSet {.union.} = object
cs: set[char]
vs: array[4, uint64]
const a = Charset(cs: {'a'..'z'})
doAssert a.repr.len > 0
import tables
block: # bug #8007