From 90598b4631e3b68565c7d62102a9e4615514a721 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 28 Feb 2018 00:51:22 +0100 Subject: fix assert on self-referencing function ptr field The construct `struct S { f: fn(S) void }` is not legal because structs are not copyable but it should not result in an ICE. Fixes #795. --- src/analyze.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index c16a5d462a..9d5e7d77af 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1670,6 +1670,9 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { if (struct_type->data.structure.is_invalid) return; + if (struct_type->data.structure.zero_bits_loop_flag) + return; + AstNode *decl_node = struct_type->data.structure.decl_node; if (struct_type->data.structure.embedded_in_current) { @@ -1682,7 +1685,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { return; } - assert(!struct_type->data.structure.zero_bits_loop_flag); assert(struct_type->data.structure.fields); assert(decl_node->type == NodeTypeContainerDecl); -- cgit v1.2.3