Skip to content

Commit

Permalink
fix rtti sizeof for varargs in global scope (nim-lang#13125) [backport]
Browse files Browse the repository at this point in the history
(cherry picked from commit bf2e052)
  • Loading branch information
Jasper Jenkins authored and narimiran committed Jan 14, 2020
1 parent 3e76777 commit 8994e8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ type
tfContravariant # contravariant generic param
tfCheckedForDestructor # type was checked for having a destructor.
# If it has one, t.destructor is not nil.
tfIncompleteStruct # treat this type as if it had sizeof(pointer)

TTypeFlags* = set[TTypeFlag]

Expand Down Expand Up @@ -577,7 +578,6 @@ type
const
routineKinds* = {skProc, skFunc, skMethod, skIterator,
skConverter, skMacro, skTemplate}
tfIncompleteStruct* = tfVarargs
tfUnion* = tfNoSideEffect
tfGcSafe* = tfThread
tfObjHasKids* = tfEnumHasHoles
Expand Down
9 changes: 9 additions & 0 deletions tests/assign/tassign.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TEMP=C:\Programs\xyz\bin
8 5 0 0
pre test a:test b:1 c:2 haha:3
assignment test a:test b:1 c:2 haha:3
abc123
'''
"""

Expand Down Expand Up @@ -207,3 +208,11 @@ when false:
var
a, b: Foo
a = b

block tgeneric_assign_varargs:
template fatal(msgs: varargs[string]) =
for msg in msgs:
stdout.write(msg)
stdout.write('\n')

fatal "abc", "123"

0 comments on commit 8994e8f

Please sign in to comment.