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