| ... | @@ -1560,6 +1560,17 @@ static void preview_fn_proto_instance(CodeGen *g, ImportTableEntry *import, AstN | ... | @@ -1560,6 +1560,17 @@ static void preview_fn_proto_instance(CodeGen *g, ImportTableEntry *import, AstN |
| 1560 | | 1560 | |
| 1561 | proto_node->data.fn_proto.fn_table_entry = fn_table_entry; | 1561 | proto_node->data.fn_proto.fn_table_entry = fn_table_entry; |
| 1562 | resolve_function_proto(g, proto_node, fn_table_entry, import, containing_context); | 1562 | resolve_function_proto(g, proto_node, fn_table_entry, import, containing_context); |
| | 1563 | |
| | 1564 | if (is_main_fn && !g->link_libc) { |
| | 1565 | TypeTableEntry *err_void = get_error_type(g, g->builtin_types.entry_void); |
| | 1566 | TypeTableEntry *actual_return_type = fn_table_entry->type_entry->data.fn.fn_type_id.return_type; |
| | 1567 | if (actual_return_type != err_void) { |
| | 1568 | AstNode *return_type_node = fn_table_entry->proto_node->data.fn_proto.return_type; |
| | 1569 | add_node_error(g, return_type_node, |
| | 1570 | buf_sprintf("expected return type of main to be '%%void', instead is '%s'", |
| | 1571 | buf_ptr(&actual_return_type->name))); |
| | 1572 | } |
| | 1573 | } |
| 1563 | } | 1574 | } |
| 1564 | | 1575 | |
| 1565 | static void preview_fn_proto(CodeGen *g, ImportTableEntry *import, AstNode *proto_node) { | 1576 | static void preview_fn_proto(CodeGen *g, ImportTableEntry *import, AstNode *proto_node) { |