aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 33cfd3dfa..d197e02d5 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1717,6 +1717,9 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
init_type = check_type(c, vd->type, NULL);
if (init_type == NULL) {
init_type = t_invalid;
+ } else if (is_type_polymorphic(init_type)) {
+ error(vd->type, "Invalid use of a polymorphic type in variable declaration");
+ init_type = t_invalid;
}
}