From 417aa575015ba8f8d9e724064d88cade96aa6d60 Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Tue, 9 Dec 2008 03:01:19 +0100 Subject: [PATCH] This ''should'' fix #139 , I failed to produce a testcase, but I would imagine this to be correct, and it removes '''that''' error when building Hybrid. --- gen/toir.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gen/toir.cpp b/gen/toir.cpp index 11829ce4..8186d963 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -224,6 +224,13 @@ LLConstant* VarExp::toConstElem(IRState* p) m = llvm::ConstantExpr::getBitCast(m, vartype); return m; } + else if (VarDeclaration* vd = var->isVarDeclaration()) + { + // return the initializer + assert(vd->init); + return DtoConstInitializer(loc, type, vd->init); + } + // fail assert(0 && "Unsupported const VarExp kind"); return NULL; }