| author | |
| committer | |
| log | 28f9230b40ee7aa179705c39616aaf2a5f303b73 |
| tree | c8fabad00b800c43143fe148557c23a64c129de0 |
| parent | b5cfbfd84ee26d5174abf3368b75b9e4502898a5 |
closes #880
closes #12122 files changed, 15 insertions(+), 0 deletions(-)
src/ir.cpp+2| ... | ... | @@ -13271,6 +13271,8 @@ static TypeTableEntry *ir_analyze_instruction_call(IrAnalyze *ira, IrInstruction |
| 13271 | 13271 | return ir_finish_anal(ira, cast_instruction->value.type); |
| 13272 | 13272 | } else if (fn_ref->value.type->id == TypeTableEntryIdFn) { |
| 13273 | 13273 | FnTableEntry *fn_table_entry = ir_resolve_fn(ira, fn_ref); |
| 13274 | if (fn_table_entry == nullptr) | |
| 13275 | return ira->codegen->builtin_types.entry_invalid; | |
| 13274 | 13276 | return ir_analyze_fn_call(ira, call_instruction, fn_table_entry, fn_table_entry->type_entry, |
| 13275 | 13277 | fn_ref, nullptr, is_comptime, call_instruction->fn_inline); |
| 13276 | 13278 | } else if (fn_ref->value.type->id == TypeTableEntryIdBoundFn) { |
test/compile_errors.zig+13| ... | ... | @@ -1,6 +1,19 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 4 | cases.add( | |
| 5 | "use of comptime-known undefined function value", | |
| 6 | \\const Cmd = struct { | |
| 7 | \\ exec: fn () void, | |
| 8 | \\}; | |
| 9 | \\export fn entry() void { | |
| 10 | \\ const command = Cmd{ .exec = undefined }; | |
| 11 | \\ command.exec(); | |
| 12 | \\} | |
| 13 | , | |
| 14 | ".tmp_source.zig:6:12: error: use of undefined value", | |
| 15 | ); | |
| 16 | ||
| 4 | 17 | cases.add( |
| 5 | 18 | "bad @alignCast at comptime", |
| 6 | 19 | \\comptime { |