From 1fc8bab6433982611b8dc3585e65dbd7be946a89 Mon Sep 17 00:00:00 2001 From: Reimer Behrends Date: Sat, 1 Nov 2014 04:07:42 +0100 Subject: [PATCH] Reset location when creating a method dispatcher When creating a method dispatcher, the location of the underlying method was copied. Under some circumstances, the name of the location (loc.r) was already initialized, in which case the method dispatcher shared a name with one of the methods, leading to a C compiler error. By setting loc.r to nil when copying the dispatcher information from the original method, we ensure that the dispatcher C function gets its proper name. --- compiler/cgmeth.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim index 948541302..9755bc674 100644 --- a/compiler/cgmeth.nim +++ b/compiler/cgmeth.nim @@ -100,6 +100,7 @@ proc methodDef*(s: PSym, fromCache: bool) = if disp.typ.callConv == ccInline: disp.typ.callConv = ccDefault disp.ast = copyTree(s.ast) disp.ast.sons[bodyPos] = ast.emptyNode + disp.loc.r = nil if s.typ.sons[0] != nil: disp.ast.sons[resultPos].sym = copySym(s.ast.sons[resultPos].sym) attachDispatcher(s, newSymNode(disp))