| author | |
| committer | |
| log | 1b8a241f6fd1ac8d42965c6aaaf4934de565b2b2 |
| tree | fe663d430faa66ee31ccd815cc370cd25d1ac9ca |
| parent | 0f449a3ec180f710f8b54023d2c3b3dffcce5ec8 |
| parent | 90598b4631e3b68565c7d62102a9e4615514a721 |
2 files changed, 15 insertions(+), 1 deletions(-)
src/analyze.cpp+3-1| ... | ... | @@ -1670,6 +1670,9 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { |
| 1670 | 1670 | if (struct_type->data.structure.is_invalid) |
| 1671 | 1671 | return; |
| 1672 | 1672 | |
| 1673 | if (struct_type->data.structure.zero_bits_loop_flag) | |
| 1674 | return; | |
| 1675 | ||
| 1673 | 1676 | AstNode *decl_node = struct_type->data.structure.decl_node; |
| 1674 | 1677 | |
| 1675 | 1678 | if (struct_type->data.structure.embedded_in_current) { |
| ... | ... | @@ -1682,7 +1685,6 @@ static void resolve_struct_type(CodeGen *g, TypeTableEntry *struct_type) { |
| 1682 | 1685 | return; |
| 1683 | 1686 | } |
| 1684 | 1687 | |
| 1685 | assert(!struct_type->data.structure.zero_bits_loop_flag); | |
| 1686 | 1688 | assert(struct_type->data.structure.fields); |
| 1687 | 1689 | assert(decl_node->type == NodeTypeContainerDecl); |
| 1688 | 1690 |
test/compile_errors.zig+12| ... | ... | @@ -3090,4 +3090,16 @@ pub fn addCases(cases: &tests.CompileErrorContext) void { |
| 3090 | 3090 | , |
| 3091 | 3091 | ".tmp_source.zig:11:20: error: runtime cast to union 'Value' which has non-void fields", |
| 3092 | 3092 | ".tmp_source.zig:3:5: note: field 'A' has type 'i32'"); |
| 3093 | ||
| 3094 | cases.add("self-referencing function pointer field", | |
| 3095 | \\const S = struct { | |
| 3096 | \\ f: fn(_: S) void, | |
| 3097 | \\}; | |
| 3098 | \\fn f(_: S) void { | |
| 3099 | \\} | |
| 3100 | \\export fn entry() void { | |
| 3101 | \\ var _ = S { .f = f }; | |
| 3102 | \\} | |
| 3103 | , | |
| 3104 | ".tmp_source.zig:4:9: error: type 'S' is not copyable; cannot pass by value"); | |
| 3093 | 3105 | } |