From: Chris Lattner Date: Tue, 7 Oct 2003 22:19:19 +0000 (+0000) Subject: Add a sanity check for constant expression casts X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9eacf8aac8fa19ec5f3e849747af860b023e4dc4;p=oota-llvm.git 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 --- 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...