From 98859a72486038995f66d499f76172bb6e670a22 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 26 Aug 2016 14:36:46 +0200 Subject: [PATCH] fixes #4292 --- compiler/sigmatch.nim | 9 +-------- tests/template/ttemp_in_varargs.nim | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 tests/template/ttemp_in_varargs.nim diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index ec429968cc..949d4dc195 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1310,7 +1310,7 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, var call = newNodeI(nkCall, arg.info) call.add(f.n.copyTree) call.add(arg.copyTree) - result = c.semOverloadedCall(c, call, call, routineKinds) + result = c.semExpr(c, call) if result != nil: # resulting type must be consistent with the other arguments: var r = typeRel(m, f.sons[0], result.typ) @@ -1320,13 +1320,6 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType, if r == isGeneric: result.typ = getInstantiatedType(c, arg, m, base(f)) m.baseTypeMatch = true - # bug #4545: allow the call to go through a 'var T': - let vt = result.sons[0].typ.sons[1] - if vt.kind == tyVar: - let x = result.sons[1] - let va = newNodeIT(nkHiddenAddr, x.info, vt) - va.add x - result.sons[1] = va proc incMatches(m: var TCandidate; r: TTypeRelation; convMatch = 1) = case r diff --git a/tests/template/ttemp_in_varargs.nim b/tests/template/ttemp_in_varargs.nim new file mode 100644 index 0000000000..be78e6ef2c --- /dev/null +++ b/tests/template/ttemp_in_varargs.nim @@ -0,0 +1,9 @@ +discard """ + output: '''a''' +""" + +# bug #4292 + +template foo(s: string): string = s +proc variadicProc*(v: varargs[string, foo]) = echo v[0] +variadicProc("a")