diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index ea4db4f516..20b1db25e6 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -3483,6 +3483,12 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = var lit = newBuilder("") genLiteral(p, sym.astdef, sym.typ, lit) putIntoDest(p, d, n, extract(lit), OnStatic) + elif optCompress in p.config.globalOptions: + # With delayed codegen, we need to ensure the definition is generated + # not just the extern header declaration + requestConstImpl(p, sym) + assert((sym.loc.snippet != "") and (sym.loc.t != nil)) + putLocIntoDest(p, d, sym.loc) elif delayedCodegen(p.module): genConstHeader(p.module, p.module, p, sym) assert((sym.loc.snippet != "") and (sym.loc.t != nil))