diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 83ff6a72..e4790c22 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -775,7 +775,9 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to) else if (fromtype->ty == Tdelegate) { return DtoCastDelegate(loc, val, to); } - else { + else if (fromtype->ty == totype->ty) { + return val; + } else { error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), to->toChars()); fatal(); }