aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-20 19:40:51 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-20 19:40:51 +0100
commit9a3b4167bb8495f9422ffa5cb242198fed3a315b (patch)
treed5e1f4fe1ff66282cb67896c7c432a487b5a55df /src/check_stmt.cpp
parent13bc6eeea4cc89b06bcfc3aaef7bfb85c1cb5b01 (diff)
Fix polymorphic element types usage; Empty `union` as opaque type
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;
}
}