Fixed segfault when compiling a non-constant case expression

This commit is contained in:
Alexey Prokhin
2012-02-13 16:25:18 +04:00
parent 9ace3fae3e
commit 52c5c03495

View File

@@ -887,7 +887,7 @@ void SwitchStatement::toIR(IRState* p)
VarDeclaration* vd = 0;
if (cs->exp->op == TOKvar)
vd = ((VarExp*)cs->exp)->var->isVarDeclaration();
if (vd && !vd->init) {
if (vd && (!vd->init || !vd->isConst())) {
cs->llvmIdx = cs->exp->toElemDtor(p)->getRVal();
useSwitchInst = false;
}