aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-05-12 22:38:37 +0100
committergingerBill <bill@gingerbill.org>2021-05-12 22:38:37 +0100
commitd962cfdc6bd1865c7df302d08af237027533437f (patch)
tree12365aa358b2ebd422f2a0fd9499520174a1cec4 /src/check_expr.cpp
parentdfb81431496f68bce56b9a92681a841b072300be (diff)
Fix #713
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;
}
}