Fix PR463
authorChris Lattner <sabre@nondot.org>
Sun, 28 Nov 2004 16:45:45 +0000 (16:45 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 28 Nov 2004 16:45:45 +0000 (16:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18303 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 1f6b53909f06c45ed708fb50c56a7521600f2441..4a4803ed875950fa386c2f1c23c2c4c290537e3e 100644 (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;
   };