From 93fb8b67b96e7df58fea34d1edfa800ff5dffd12 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 23 Dec 2016 12:27:14 +0100 Subject: fixes #5142 --- compiler/ccgtypes.nim | 10 ++++++---- tests/cpp/tembarrassing_generic_failure.nim | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 tests/cpp/tembarrassing_generic_failure.nim diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index a173095e8..aa0b983ff 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -116,16 +116,18 @@ proc mangleName(m: BModule; s: PSym): Rope = add(result, m.idOrSig(s)) s.loc.r = result + +const + irrelevantForBackend = {tyGenericBody, tyGenericInst, tyGenericInvocation, + tyDistinct, tyRange, tyStatic, tyAlias} + proc typeName(typ: PType): Rope = + let typ = typ.skipTypes(irrelevantForBackend) result = if typ.sym != nil and typ.kind in {tyObject, tyEnum}: typ.sym.name.s.mangle.rope else: ~"TY" -const - irrelevantForBackend = {tyGenericBody, tyGenericInst, tyGenericInvocation, - tyDistinct, tyRange, tyStatic, tyAlias} - proc getTypeName(m: BModule; typ: PType; sig: SigHash): Rope = var t = typ while true: diff --git a/tests/cpp/tembarrassing_generic_failure.nim b/tests/cpp/tembarrassing_generic_failure.nim new file mode 100644 index 000000000..3c31dcdb8 --- /dev/null +++ b/tests/cpp/tembarrassing_generic_failure.nim @@ -0,0 +1,8 @@ +discard """ + cmd: "nim cpp --threads:on $file" +""" + +# bug #5142 + +var ci: Channel[int] +ci.open -- cgit 1.4.1-2-gfad0