* fixes #9794 * Fix linux test
This commit is contained in:
parent
2ac7f52388
commit
ea5fc9f204
2 changed files with 21 additions and 4 deletions
|
|
@ -310,9 +310,9 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
|
||||||
for i in countup(0, sonsLen(typ) - 1):
|
for i in countup(0, sonsLen(typ) - 1):
|
||||||
let child = typ.sons[i]
|
let child = typ.sons[i]
|
||||||
computeSizeAlign(conf, child)
|
computeSizeAlign(conf, child)
|
||||||
if child.size == szIllegalRecursion:
|
if child.size < 0:
|
||||||
typ.size = szIllegalRecursion
|
typ.size = child.size
|
||||||
typ.align = szIllegalRecursion
|
typ.align = child.align
|
||||||
return
|
return
|
||||||
maxAlign = max(maxAlign, child.align)
|
maxAlign = max(maxAlign, child.align)
|
||||||
sizeAccum = align(sizeAccum, child.align) + child.size
|
sizeAccum = align(sizeAccum, child.align) + child.size
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: "abc"
|
output: '''abc
|
||||||
|
16 == 16'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -14,3 +15,19 @@ doAssert TA.sizeof == string.sizeof
|
||||||
|
|
||||||
echo a.x
|
echo a.x
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# bug #9794
|
||||||
|
##########################################
|
||||||
|
type
|
||||||
|
imported_double {.importc: "double".} = object
|
||||||
|
|
||||||
|
Pod = object
|
||||||
|
v* : imported_double
|
||||||
|
seed*: int32
|
||||||
|
|
||||||
|
Pod2 = tuple[v: imported_double, seed: int32]
|
||||||
|
|
||||||
|
proc test() =
|
||||||
|
echo sizeof(Pod), " == ",sizeof(Pod2)
|
||||||
|
|
||||||
|
test()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue