Fix PR463

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18303 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-11-28 16:45:45 +00:00
parent 2ded5d0053
commit 7891593359

View File

@ -1294,7 +1294,10 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
delete $1;
}
| Types ZEROINITIALIZER {
$$ = Constant::getNullValue($1->get());
const Type *Ty = $1->get();
if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(Ty))
ThrowException("Cannot create a null initialized value of this type!");
$$ = Constant::getNullValue(Ty);
delete $1;
};