From 9a3b4167bb8495f9422ffa5cb242198fed3a315b Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 20 Jul 2017 19:40:51 +0100 Subject: Fix polymorphic element types usage; Empty `union` as opaque type --- src/check_stmt.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/check_stmt.cpp') 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; } } -- cgit v1.2.3