This commit is contained in:
Araq
2019-07-01 13:12:04 +02:00
parent c352892232
commit bd55c862a6

View File

@@ -352,6 +352,9 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
t = skipTypes(t.sons[0], {tyGenericInst, tyAlias, tySink, tyOwned})
if optNimV2 in c.config.globalOptions:
result.typ = makeVarType(c, result.typ, tyOwned)
# we have to watch out, there are also 'owned proc' types that can be used
# multiple times as long as they don't have closures.
result.typ.flags.incl tfHasOwned
if t.kind != tyObject:
localError(c.config, n.info, errGenerated, "object constructor needs an object type")
return