destructors: supportsCopyMem finally works for recursive types

This commit is contained in:
Araq 2017-10-25 08:39:56 +02:00
commit 3aa7c2232e
6 changed files with 53 additions and 18 deletions

View file

@ -319,6 +319,8 @@ proc liftTypeBoundOps*(c: PContext; typ: PType; info: TLineInfo) =
## to ensure we lift assignment, destructors and moves properly.
## The later 'destroyer' pass depends on it.
if not newDestructors or not hasDestructor(typ): return
# do not produce wrong liftings while we're still instantiating generics:
if c.typesWithOps.len > 0: return
let typ = typ.skipTypes({tyGenericInst, tyAlias})
# we generate the destructor first so that other operators can depend on it:
if typ.destructor == nil: