summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/destroyer.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/destroyer.nim b/compiler/destroyer.nim
index 0570873ea..dd12a7966 100644
--- a/compiler/destroyer.nim
+++ b/compiler/destroyer.nim
@@ -601,6 +601,10 @@ proc p(n: PNode; c: var Con): PNode =
   of nkNone..nkNilLit, nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef,
       nkIteratorDef, nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
     result = n
+  of nkDiscardStmt:
+    result = n
+    if n[0].typ != nil and hasDestructor(n[0].typ):
+      result = genDestroy(c, n[0].typ, n[0])
   of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
     result = copyNode(n)
     # Destination type