Add a sanity check for constant expression casts

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8951 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-10-07 22:19:19 +00:00
parent fcc54b3ede
commit 9eacf8aac8

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...