From 098ceb55671ac47a600de9face7f7ad20b96fb88 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 6 Feb 2012 15:17:25 -0800 Subject: [PATCH] Issue error on attempted type convert from/to function type. --- expr.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/expr.cpp b/expr.cpp index 4ee0b52e..ac569693 100644 --- a/expr.cpp +++ b/expr.cpp @@ -211,6 +211,21 @@ lDoTypeConv(const Type *fromType, const Type *toType, Expr **expr, return false; } + if (dynamic_cast(fromType)) { + if (!failureOk) + Error(pos, "Can't convert function type \"%s\" to \"%s\" for %s.", + fromType->GetString().c_str(), + toType->GetString().c_str(), errorMsgBase); + return false; + } + if (dynamic_cast(toType)) { + if (!failureOk) + Error(pos, "Can't convert from type \"%s\" to function type \"%s\" " + "for %s.", fromType->GetString().c_str(), + toType->GetString().c_str(), errorMsgBase); + return false; + } + const ArrayType *toArrayType = dynamic_cast(toType); const ArrayType *fromArrayType = dynamic_cast(fromType); const VectorType *toVectorType = dynamic_cast(toType);