Make sure people don't make functiontypes with an invalid return type
authorChris Lattner <sabre@nondot.org>
Tue, 6 Jul 2004 23:25:19 +0000 (23:25 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 6 Jul 2004 23:25:19 +0000 (23:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14654 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index 50248f21e074161b2da453be1d83bb25e8804423..74542b8e44baa9a3d150e59608cbe636774e31e3 100644 (file)
@@ -402,6 +402,8 @@ FunctionType::FunctionType(const Type *Result,
                            const std::vector<const Type*> &Params, 
                            bool IsVarArgs) : DerivedType(FunctionTyID), 
                                              isVarArgs(IsVarArgs) {
+  assert((Result->isFirstClassType() || Result == Type::VoidTy) && 
+         "LLVM functions cannot return aggregates");
   bool isAbstract = Result->isAbstract();
   ContainedTys.reserve(Params.size()+1);
   ContainedTys.push_back(PATypeHandle(Result, this));