diff options
author | andri lim <jangko128@gmail.com> | 2018-06-05 09:18:20 +0700 |
---|---|---|
committer | andri lim <jangko128@gmail.com> | 2018-06-05 09:18:20 +0700 |
commit | 80107b360c8bb01efba39a9a4a0b9129b300a248 (patch) | |
tree | d3171c3d3e42b4c6c219b633300587125a317847 /compiler | |
parent | 069a53ad4bff8a3160794360227eceb1fc37d8d8 (diff) | |
download | Nim-80107b360c8bb01efba39a9a4a0b9129b300a248.tar.gz |
add more test to 4799
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgexprs.nim | 4 | ||||
-rw-r--r-- | compiler/sigmatch.nim | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 335aa2f84..ad36d3e92 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -351,7 +351,9 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = else: useStringh(p.module) linefmt(p, cpsStmts, - "memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($1[0])*$1Len_0);$n", + # bug #4799, keep the memcpy for a while + #"memcpy((void*)$1, (NIM_CONST void*)$2, sizeof($1[0])*$1Len_0);$n", + "$1 = $2;$n", rdLoc(dest), rdLoc(src)) of tySet: if mapType(ty) == ctArray: diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 41cac2a4a..fcfdda8bb 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -2013,6 +2013,14 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType, if r == isGeneric: result.typ = getInstantiatedType(c, arg, m, base(f)) m.baseTypeMatch = true + # bug #4799, varargs accepting subtype relation object + elif r == isSubtype: + inc(m.subtypeMatches) + if f.kind == tyTypeDesc: + result = arg + else: + result = implicitConv(nkHiddenSubConv, f, arg, m, c) + m.baseTypeMatch = true else: result = userConvMatch(c, m, base(f), a, arg) if result != nil: m.baseTypeMatch = true |