fixes #6016 union alias trigger bad codegen (#6117)

* fixes #6016 union alias trigger bad codegen
* cpp test ok
* merging some test into one file
This commit is contained in:
andri lim 2017-08-03 16:03:47 +07:00 • committed by Andreas Rumpf
commit 57edf619fe
6 changed files with 176 additions and 141 deletions

View file

@ -1,5 +1,22 @@
discard """
output: '''100'''
cmd: "nim cpp $file"
"""
import typeinfo
#bug #6016
type
Onion {.union.} = object
field1: int
field2: uint64
Stroom = Onion
PStroom = ptr Stroom
proc pstruct(u: PStroom) =
echo u.field2
var x = Onion(field1: 100)
pstruct(x.addr)