Mercurial > projects > ldc
changeset 628:e3c46bcce65f
Detect a missing global before trying to const init it.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Wed, 01 Oct 2008 20:32:12 +0200 |
parents | 79cbe5034fec |
children | 607b6b5819a7 bc83491463f0 |
files | gen/toir.cpp |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/toir.cpp Wed Oct 01 19:19:26 2008 +0200 +++ b/gen/toir.cpp Wed Oct 01 20:32:12 2008 +0200 @@ -128,7 +128,6 @@ // 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 @@ 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()); } }