From 8994e8f2e2ebc5073bf424c133530e4f52ef7063 Mon Sep 17 00:00:00 2001 From: Jasper Jenkins Date: Mon, 13 Jan 2020 01:17:22 -0800 Subject: [PATCH] fix rtti sizeof for varargs in global scope (#13125) [backport] (cherry picked from commit bf2e052e6d97c1117603480547804dd98d1ada71) --- compiler/ast.nim | 2 +- tests/assign/tassign.nim | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index f24008b305..eabb5736d2 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -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] @@ -577,7 +578,6 @@ type const routineKinds* = {skProc, skFunc, skMethod, skIterator, skConverter, skMacro, skTemplate} - tfIncompleteStruct* = tfVarargs tfUnion* = tfNoSideEffect tfGcSafe* = tfThread tfObjHasKids* = tfEnumHasHoles diff --git a/tests/assign/tassign.nim b/tests/assign/tassign.nim index b421802aed..0589b02148 100644 --- a/tests/assign/tassign.nim +++ b/tests/assign/tassign.nim @@ -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 ''' """ @@ -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"