mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
This commit is contained in:
parent
e9a49f28b2
commit
bc24e53565
2 changed files with 12 additions and 2 deletions
|
@ -893,8 +893,10 @@ void DtoResolveVariable(VarDeclaration *vd) {
|
|||
// 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();
|
||||
// We also do so for forward-declared (extern) globals, just like clang.
|
||||
const bool isLLConst = (vd->isConst() || vd->isImmutable()) &&
|
||||
((vd->_init && !vd->_init->isVoidInitializer()) ||
|
||||
(vd->storage_class & STCextern));
|
||||
|
||||
assert(!vd->ir->isInitialized());
|
||||
if (gIR->dmodule) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue