| author | |
| committer | |
| log | 1c60f3145098cda92a7bd90ed0fce4bd75a03d1c |
| tree | 11e9bf1b797e217169f2d2d4d3e3fa8bfa151571 |
| parent | 2b5e0b66a27d2a83cb596a28c9792a86523401b3 |
2 files changed, 19 insertions(+), 0 deletions(-)
src/ir.cpp+9| ... | ... | @@ -9837,6 +9837,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal |
| 9837 | 9837 | |
| 9838 | 9838 | AstNode *fn_proto_node = fn_entry ? fn_entry->proto_node : nullptr;; |
| 9839 | 9839 | |
| 9840 | if (fn_type_id->cc == CallingConventionNaked) { | |
| 9841 | ErrorMsg *msg = ir_add_error(ira, fn_ref, buf_sprintf("unable to call function with naked calling convention")); | |
| 9842 | if (fn_proto_node) { | |
| 9843 | add_error_note(ira->codegen, msg, fn_proto_node, buf_sprintf("declared here")); | |
| 9844 | } | |
| 9845 | return ira->codegen->builtin_types.entry_invalid; | |
| 9846 | } | |
| 9847 | ||
| 9848 | ||
| 9840 | 9849 | if (fn_type_id->is_var_args) { |
| 9841 | 9850 | if (call_param_count < src_param_count) { |
| 9842 | 9851 | ErrorMsg *msg = ir_add_error_node(ira, source_node, |
test/compile_errors.zig+10| ... | ... | @@ -1,6 +1,16 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: &tests.CompileErrorContext) void { |
| 4 | cases.add("calling function with naked calling convention", | |
| 5 | \\export fn entry() void { | |
| 6 | \\ foo(); | |
| 7 | \\} | |
| 8 | \\nakedcc fn foo() void { } | |
| 9 | , | |
| 10 | ".tmp_source.zig:2:5: error: unable to call function with naked calling convention", | |
| 11 | ".tmp_source.zig:4:9: note: declared here"); | |
| 12 | ||
| 13 | ||
| 4 | 14 | cases.add("function with invalid return type", |
| 5 | 15 | \\export fn foo() boid {} |
| 6 | 16 | , ".tmp_source.zig:1:17: error: use of undeclared identifier 'boid'"); |