fixes #9610
This commit is contained in:
parent
7a15d2d04b
commit
a2e6a873af
1 changed files with 13 additions and 17 deletions
|
|
@ -329,23 +329,19 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
||||||
of mTypeOf:
|
of mTypeOf:
|
||||||
result = semTypeOf(c, n)
|
result = semTypeOf(c, n)
|
||||||
of mSizeOf:
|
of mSizeOf:
|
||||||
# TODO there is no proper way to find out if a type cannot be queried for the size.
|
# TODO there is no proper way to find out if a type cannot be queried for the size.
|
||||||
let size = getSize(c.config, n[1].typ)
|
let size = getSize(c.config, n[1].typ)
|
||||||
# We just assume here that the type might come from the c backend
|
# We just assume here that the type might come from the c backend
|
||||||
if size == szUnknownSize:
|
if size == szUnknownSize:
|
||||||
# Forward to the c code generation to emit a `sizeof` in the C code.
|
# Forward to the c code generation to emit a `sizeof` in the C code.
|
||||||
result = n
|
result = n
|
||||||
elif size >= 0:
|
elif size >= 0:
|
||||||
result = newIntNode(nkIntLit, size)
|
result = newIntNode(nkIntLit, size)
|
||||||
result.info = n.info
|
result.info = n.info
|
||||||
result.typ = n.typ
|
result.typ = n.typ
|
||||||
else:
|
else:
|
||||||
|
localError(c.config, n.info, "cannot evaluate 'sizeof' because its type is not defined completely")
|
||||||
localError(c.config, n.info, "cannot evaluate 'sizeof' because its type is not defined completely")
|
result = n
|
||||||
|
|
||||||
result = nil
|
|
||||||
|
|
||||||
|
|
||||||
of mAlignOf:
|
of mAlignOf:
|
||||||
result = newIntNode(nkIntLit, getAlign(c.config, n[1].typ))
|
result = newIntNode(nkIntLit, getAlign(c.config, n[1].typ))
|
||||||
result.info = n.info
|
result.info = n.info
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue