Add a sanity check for constant expression casts

llvm-svn: 8951
This commit is contained in:
Chris Lattner 2003-10-07 22:19:19 +00:00
parent f090d28209
commit bd123c6e51

View File

@ -897,6 +897,8 @@ struct ConvertConstantType<ConstantExpr, Type> {
static ValueMap<ExprMapKeyType, Type, ConstantExpr> 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...