From 31263ef8f3ed7dfea7b4e635aede5a1d627db031 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sun, 4 Feb 2018 07:35:32 +0100 Subject: [PATCH] fixes #5450 --- compiler/semobjconstr.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 46e6ef25d..63a4eb99a 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -260,6 +260,10 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode = result = newNodeIT(nkObjConstr, n.info, t) for child in n: result.add child + if t == nil: + localError(n.info, errGenerated, "object constructor needs an object type") + return + t = skipTypes(t, {tyGenericInst, tyAlias, tySink}) if t.kind == tyRef: t = skipTypes(t.sons[0], {tyGenericInst, tyAlias, tySink}) if t.kind != tyObject: