mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-07 19:36:06 +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) {
|
||||
|
|
8
tests/compilable/gh2849.d
Normal file
8
tests/compilable/gh2849.d
Normal file
|
@ -0,0 +1,8 @@
|
|||
// RUN: %ldc -c %s
|
||||
|
||||
extern(C++):
|
||||
|
||||
__gshared const int dblreg = 1;
|
||||
|
||||
pragma(mangle, dblreg.mangleof)
|
||||
extern __gshared const int bla;
|
Loading…
Add table
Add a link
Reference in a new issue