Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion gen/llvmhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,11 @@ void DtoResolveVariable(VarDeclaration* vd)
Logger::println("parent: null");
}

const bool isLLConst = (vd->isConst() || vd->isImmutable()) && vd->init;
// If a const/immutable value has a proper initializer (not "= void"),
// it cannot be assigned again in a static constructor. Thus, we can
// emit it as read-only data.
const bool isLLConst = (vd->isConst() || vd->isImmutable()) &&
vd->init && !vd->init->isVoidInitializer();

assert(!vd->ir.isInitialized());
if (gIR->dmodule)
Expand Down