aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/VMCore/Verifier.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 1a7100e5a4..e86c89bfa8 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -585,13 +585,13 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
"Function return type does not match operand "
"type of return inst!", &RI, F->getReturnType());
- else {
- const StructType *STy = cast<StructType>(F->getReturnType());
+ else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
for (unsigned i = 0; i < N; i++)
Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
- "Function return type does not match operand "
- "type of return inst!", &RI, F->getReturnType());
- }
+ "Function return type does not match operand "
+ "type of return inst!", &RI, F->getReturnType());
+ } else
+ Assert1(0, "Invalid return type!", &RI);
// Check to make sure that the return value has necessary properties for
// terminators...