diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-06-21 19:58:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 19:58:37 +0200 |
commit | 3ba0c30758e1044aba11bb908a7d83de7ea215bc (patch) | |
tree | ed9c8151cc4b39de7ed900023ca7bd7cc4e4494e /compiler | |
parent | c7dee55b87fe0f35a411b4ec48f833be5537a231 (diff) | |
download | Nim-3ba0c30758e1044aba11bb908a7d83de7ea215bc.tar.gz |
sizeof for empty objects/tuples should be 1; fixes #14690 (#14751)
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sizealignoffsetimpl.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim index 9d12297ea..4d73923db 100644 --- a/compiler/sizealignoffsetimpl.nim +++ b/compiler/sizealignoffsetimpl.nim @@ -330,7 +330,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = sym.offset = accum.offset accum.inc(int(child.size)) typ.paddingAtEnd = int16(accum.finish()) - typ.size = accum.offset + typ.size = if accum.offset == 0: 1 else: accum.offset typ.align = int16(accum.maxAlign) except IllegalTypeRecursionError: typ.paddingAtEnd = szIllegalRecursion @@ -388,7 +388,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) = typ.align = szUnknownSize typ.paddingAtEnd = szUnknownSize else: - typ.size = accum.offset + typ.size = if accum.offset == 0: 1 else: accum.offset typ.align = int16(accum.maxAlign) typ.paddingAtEnd = paddingAtEnd except IllegalTypeRecursionError: |