Offsetof fixes (#11690)

* first fixes

* more tests and fixes

* code normalization
This commit is contained in:
Arne Döring 2019-07-09 09:07:45 +02:00 • committed by Andreas Rumpf
commit 11dad688fe
8 changed files with 241 additions and 81 deletions

View file

@ -1310,8 +1310,12 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest; m: TMagic) =
# produces a value
else:
globalError(c.config, n.info, "expandToAst requires a call expression")
of mSizeOf, mAlignOf:
globalError(c.config, n.info, "cannot evaluate 'sizeof/alignof' because its type is not defined completely")
of mSizeOf:
globalError(c.config, n.info, "cannot evaluate 'sizeof' because its type is not defined completely")
of mAlignOf:
globalError(c.config, n.info, "cannot evaluate 'alignof' because its type is not defined completely")
of mOffsetOf:
globalError(c.config, n.info, "cannot evaluate 'offsetof' because its type is not defined completely")
of mRunnableExamples:
discard "just ignore any call to runnableExamples"
of mDestroy: discard "ignore calls to the default destructor"