aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index a64acf744..26c7983de 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -5572,9 +5572,15 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call, Ast *pr
}
check_expr(c, operand, arg);
if (operand->mode != Addressing_Invalid) {
- check_cast(c, operand, t);
+ if (is_type_polymorphic(t)) {
+ error(call, "A polymorphic type cannot be used in a type conversion");
+ } else {
+ // NOTE(bill): Otherwise the compiler can override the polymorphic type
+ // as it assumes it is determining the type
+ check_cast(c, operand, t);
+ }
}
-
+ operand->type = t;
break;
}
}