diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 27dbf8871a6..c13737aae52 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1911,6 +1911,11 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID, &Ignored); } V = ConstantFP::get(ID.APFloatVal); + + if (V->getType() != Ty) + return Error(ID.Loc, "floating point constant does not have type '" + + Ty->getDescription() + "'"); + return false; case ValID::t_Null: if (!isa(Ty))