From 9a7b6af5fab3dc418ca4e63e071f3764ec1b73de Mon Sep 17 00:00:00 2001 From: Matthew Baulch Date: Tue, 5 Jul 2016 06:14:36 +1000 Subject: [PATCH 1/2] Report wrong arg count when too many params and no varargs. --- compiler/ccgcalls.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index bd17f85e4..879b57423 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -260,6 +260,8 @@ proc genOtherArg(p: BProc; ri: PNode; i: int; typ: PType): Rope = else: result = genArgNoParam(p, ri.sons[i]) #, typ.n.sons[i].sym) else: + if tfVarargs notin typ.flags: + localError(ri.info, "wrong argument count") result = genArgNoParam(p, ri.sons[i]) discard """ From a2301f64cdbb0efaf88dc4f5398c53ef95ba4a57 Mon Sep 17 00:00:00 2001 From: Matthew Baulch Date: Tue, 5 Jul 2016 23:16:57 +1000 Subject: [PATCH 2/2] Return nil from genOtherArg after error. --- compiler/ccgcalls.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim index 879b57423..bd1a4101a 100644 --- a/compiler/ccgcalls.nim +++ b/compiler/ccgcalls.nim @@ -262,7 +262,9 @@ proc genOtherArg(p: BProc; ri: PNode; i: int; typ: PType): Rope = else: if tfVarargs notin typ.flags: localError(ri.info, "wrong argument count") - result = genArgNoParam(p, ri.sons[i]) + result = nil + else: + result = genArgNoParam(p, ri.sons[i]) discard """ Dot call syntax in C++