Commit 3697022a41

Andrew Kelley <andrew@ziglang.org>
2021-05-17 22:44:20
stage2: avoid calling freeDecl when hasCodeGenBits == false
Previously the frontend incorrectly called freeDecl for structs, which never got allocateDecl called for them. There was simply a missing check for hasCodeGenBits().
1 parent d839835
Changed files (1)
src/Module.zig
@@ -3499,9 +3499,11 @@ pub fn deleteDecl(
     }
     _ = mod.compile_log_decls.swapRemove(decl);
     mod.deleteDeclExports(decl);
-    mod.comp.bin_file.freeDecl(decl);
 
     if (decl.has_tv) {
+        if (decl.ty.hasCodeGenBits()) {
+            mod.comp.bin_file.freeDecl(decl);
+        }
         if (decl.getInnerNamespace()) |namespace| {
             try namespace.deleteAllDecls(mod, outdated_decls);
         }