not nil types are illegal to construct through default(T)
This commit is contained in:
parent
1b570f2b18
commit
f3be5a716f
2 changed files with 16 additions and 0 deletions
|
|
@ -2270,6 +2270,8 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
|||
let typ = result[1].typ.base
|
||||
if typ.kind == tyObject:
|
||||
checkDefaultConstruction(c, typ, n.info)
|
||||
elif typ.kind in {tyRef, tyPtr} and tfNotNil in typ.flags:
|
||||
localError(c.config, n.info, "not nil types don't have a default value")
|
||||
else:
|
||||
result = semDirectOp(c, n, flags)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue