diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 3e481fd0481..4e1d905fecb 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -897,6 +897,8 @@ struct ConvertConstantType { static ValueMap ExprConstants; Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) { + assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!"); + if (Constant *FC = ConstantFoldCastInstruction(C, Ty)) return FC; // Fold a few common cases...