Plug another hole: default(T) forbidden for objects requiring initialization
This commit is contained in:
parent
05a0ec4adb
commit
8ae48292ff
5 changed files with 31 additions and 19 deletions
|
|
@ -2264,6 +2264,12 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
|
|||
of mSizeOf:
|
||||
markUsed(c, n.info, s)
|
||||
result = semSizeof(c, setMs(n, s))
|
||||
of mDefault:
|
||||
result = semDirectOp(c, n, flags)
|
||||
c.config.internalAssert result[1].typ.kind == tyTypeDesc
|
||||
let typ = result[1].typ.base
|
||||
if typ.kind in {tyObject, tyTuple}:
|
||||
checkDefaultConstruction(c, typ, n.info)
|
||||
else:
|
||||
result = semDirectOp(c, n, flags)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue