summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-02-17 17:44:52 +0100
committerAraq <rumpf_a@web.de>2017-02-17 17:44:52 +0100
commitdd8cbf5fca7becf43b5cec07ecf7e579308e2e7a (patch)
tree378ab9324256a2462115834d857ef300bdadec9e /compiler
parent5620e085637fb3b090ce05092a4258427cd3e41a (diff)
downloadNim-dd8cbf5fca7becf43b5cec07ecf7e579308e2e7a.tar.gz
fixes #5404
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index e30fe5598..29d4e23c9 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -24,7 +24,13 @@ proc isKeyword(w: PIdent): bool =
 
 proc mangleField(m: BModule; name: PIdent): string =
   result = mangle(name.s)
-  if isKeyword(name) or m.g.config.cppDefines.contains(result):
+  # fields are tricky to get right and thanks to generic types producing
+  # duplicates we can end up mangling the same field multiple times. However
+  # if we do so, the 'cppDefines' table might be modified in the meantime
+  # meaning we produce inconsistent field names (see bug #5404).
+  # Hence we do not check for ``m.g.config.cppDefines.contains(result)`` here
+  # anymore:
+  if isKeyword(name):
     result.add "_0"
 
 when false: