diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index d78c8e26..1339dc1b 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -821,6 +821,13 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to) LLValue *rval = DtoBitCast(val->getRVal(), DtoType(to)); return new DImValue(to, rval); } + else if (totype->ty == Tbool) + { + IF_LOG Logger::println("Casting AA to bool."); + LLValue* rval = val->getRVal(); + LLValue* zero = LLConstant::getNullValue(rval->getType()); + return new DImValue(to, gIR->ir->CreateICmpNE(rval, zero)); + } // Else try dealing with the rewritten (struct) type. fromtype = static_cast(fromtype)->getImpl()->type;