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.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index a55e74350..189bff7fd 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -1733,6 +1733,11 @@ void check_stmt_internal(Checker *c, AstNode *node, u32 flags) {
error(vd->type, "Invalid use of a polymorphic type `%s` in variable declaration", str);
gb_string_free(str);
init_type = t_invalid;
+ } else if (is_type_empty_union(init_type)) {
+ gbString str = type_to_string(init_type);
+ error(vd->type, "An empty union `%s` cannot be instantiated in variable declaration", str);
+ gb_string_free(str);
+ init_type = t_invalid;
}
}