fixes #4292
This commit is contained in:
parent
1d1253c87f
commit
98859a7248
2 changed files with 10 additions and 8 deletions
|
|
@ -1310,7 +1310,7 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType,
|
||||||
var call = newNodeI(nkCall, arg.info)
|
var call = newNodeI(nkCall, arg.info)
|
||||||
call.add(f.n.copyTree)
|
call.add(f.n.copyTree)
|
||||||
call.add(arg.copyTree)
|
call.add(arg.copyTree)
|
||||||
result = c.semOverloadedCall(c, call, call, routineKinds)
|
result = c.semExpr(c, call)
|
||||||
if result != nil:
|
if result != nil:
|
||||||
# resulting type must be consistent with the other arguments:
|
# resulting type must be consistent with the other arguments:
|
||||||
var r = typeRel(m, f.sons[0], result.typ)
|
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:
|
if r == isGeneric:
|
||||||
result.typ = getInstantiatedType(c, arg, m, base(f))
|
result.typ = getInstantiatedType(c, arg, m, base(f))
|
||||||
m.baseTypeMatch = true
|
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) =
|
proc incMatches(m: var TCandidate; r: TTypeRelation; convMatch = 1) =
|
||||||
case r
|
case r
|
||||||
|
|
|
||||||
9
tests/template/ttemp_in_varargs.nim
Normal file
9
tests/template/ttemp_in_varargs.nim
Normal file
|
|
@ -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")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue