mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Detect a missing global before trying to const init it.
This commit is contained in:
@@ -128,7 +128,6 @@ DValue* VarExp::toElem(IRState* p)
|
||||
// take care of forward references of global variables
|
||||
if (vd->isDataseg() || (vd->storage_class & STCextern)) {
|
||||
vd->toObjFile(0); // TODO: multiobj
|
||||
DtoConstInitGlobal(vd);
|
||||
}
|
||||
if (!vd->ir.isSet() || !vd->ir.getIrValue() || DtoType(vd->type)->isAbstract()) {
|
||||
error("global variable %s not resolved", vd->toChars());
|
||||
@@ -136,6 +135,9 @@ DValue* VarExp::toElem(IRState* p)
|
||||
Logger::cout() << "unresolved global had type: " << *DtoType(vd->type) << '\n';
|
||||
fatal();
|
||||
}
|
||||
if (vd->isDataseg() || (vd->storage_class & STCextern)) {
|
||||
DtoConstInitGlobal(vd);
|
||||
}
|
||||
return new DVarValue(type, vd, vd->ir.getIrValue());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user