From 777c28cf45fea647d2f394e1427631e4620da8ef Mon Sep 17 00:00:00 2001 From: cooldome Date: Thu, 8 Oct 2020 08:12:03 +0100 Subject: [PATCH] fix #15516 (#15518) (cherry picked from commit fe187719abf5fa87e12e4092f87c270234fad25c) --- compiler/sizealignoffsetimpl.nim | 10 ++++++---- tests/misc/tsizeof.nim | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim index 81d2f5faff..1e4c88c2f5 100644 --- a/compiler/sizealignoffsetimpl.nim +++ b/compiler/sizealignoffsetimpl.nim @@ -138,12 +138,13 @@ proc computeObjectOffsetsFoldFunction(conf: ConfigRef; n: PNode, packed: bool, a accum.offset = szUnknownSize accum.maxAlign = szUnknownSize else: - # the union neds to be aligned first, before the offsets can be assigned + # the union needs to be aligned first, before the offsets can be assigned accum.align(maxChildAlign) let accumRoot = accum # copy, because each branch should start af the same offset for i in 1.. 10 - testSizeAlignOf(t,a,b,c,d,e,f,g,ro,go,po, e1, e2, e4, e8, eoa, eob, capo) + testSizeAlignOf(t,a,b,c,d,e,f,g,ro,go,po, e1, e2, e4, e8, eoa, eob, capo, issue15516) type WithBitsize {.objectconfig.} = object