# HG changeset patch # User Christian Kamm # Date 1222885932 -7200 # Node ID e3c46bcce65f1875913b2104a7454d1096c6996f # Parent 79cbe5034fec3b6bfe108d0d628cbdfa395cc44e Detect a missing global before trying to const init it. diff -r 79cbe5034fec -r e3c46bcce65f gen/toir.cpp --- 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()); } }