| author | |
| committer | |
| log | aa31096cbd0d66d7c31e12eebe91f36293346dba |
| tree | 7908a5ffa180b1539c3d77dfd6336f90904e06be |
| parent | e4977f3e89fcc164a4d02cd38eb066cfe1a1124f |
| signature |
3 files changed, 13 insertions(+), 1 deletions(-)
src/Sema.zig+3| ... | @@ -7132,6 +7132,9 @@ fn analyzeCall( | ... | @@ -7132,6 +7132,9 @@ fn analyzeCall( |
| 7132 | const callee_ty = sema.typeOf(func); | 7132 | const callee_ty = sema.typeOf(func); |
| 7133 | const func_ty_info = mod.typeToFunc(func_ty).?; | 7133 | const func_ty_info = mod.typeToFunc(func_ty).?; |
| 7134 | const cc = func_ty_info.cc; | 7134 | const cc = func_ty_info.cc; |
| 7135 | if (try sema.resolveValue(func)) |func_val| | ||
| 7136 | if (func_val.isUndef(mod)) | ||
| 7137 | return sema.failWithUseOfUndef(block, call_src); | ||
| 7135 | if (cc == .Naked) { | 7138 | if (cc == .Naked) { |
| 7136 | const maybe_decl = try sema.funcDeclSrc(func); | 7139 | const maybe_decl = try sema.funcDeclSrc(func); |
| 7137 | const msg = msg: { | 7140 | const msg = msg: { |
test/cases/compile_errors/refer_to_the_type_of_a_generic_function.zig+1-1| ... | @@ -8,4 +8,4 @@ export fn entry() void { | ... | @@ -8,4 +8,4 @@ export fn entry() void { |
| 8 | // backend=stage2 | 8 | // backend=stage2 |
| 9 | // target=native | 9 | // target=native |
| 10 | // | 10 | // |
| 11 | // :4:5: error: use of undefined value here causes undefined behavior | 11 | // :4:6: error: use of undefined value here causes undefined behavior |
test/cases/compile_errors/undefined_value_call.zig created+9| ... | @@ -0,0 +1,9 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | @as(fn () void, undefined)(); | ||
| 3 | } | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage2 | ||
| 7 | // target=native | ||
| 8 | // | ||
| 9 | // :2:31: error: use of undefined value here causes undefined behavior | ||