diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-02-12 22:00:31 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-13 23:30:14 +0100 |
commit | 28394153aba1e1ec0410406392e26e1e7e2e681e (patch) | |
tree | 0f2f455db7375b8e2c1e57b56a7f7d950d955bab /compiler/semmagic.nim | |
parent | 304b1dd34bc52df29528c2a12f769cb59904db5a (diff) | |
download | Nim-28394153aba1e1ec0410406392e26e1e7e2e681e.tar.gz |
32 bit fixes (#10608)
Diffstat (limited to 'compiler/semmagic.nim')
-rw-r--r-- | compiler/semmagic.nim | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 6e5563d69..77286393e 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -353,9 +353,17 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode, localError(c.config, n.info, "cannot evaluate 'sizeof' because its type is not defined completely, type: " & n[1].typ.typeToString) result = n of mAlignOf: - result = newIntNode(nkIntLit, getAlign(c.config, n[1].typ)) - result.info = n.info - result.typ = n.typ + # this is 100% analog to mSizeOf, could be made more dry. + let align = getAlign(c.config, n[1].typ) + if align == szUnknownSize: + result = n + elif align >= 0: + result = newIntNode(nkIntLit, align) + result.info = n.info + result.typ = n.typ + else: + localError(c.config, n.info, "cannot evaluate 'alignof' because its type is not defined completely, type: " & n[1].typ.typeToString) + result = n of mOffsetOf: var dotExpr: PNode |