Sema: add error for signed integer division

stage1 error reads

error: division with 'i32' and 'comptime_int': signed integers must use @divTrunc, @divFloor, or @divExact

Fixes: #12339
This commit is contained in:
martinhath
2022-08-12 10:45:11 +02:00
committed by GitHub
parent fa50e179f7
commit 92568a0097
3 changed files with 15 additions and 10 deletions

View File

@@ -0,0 +1,9 @@
export fn foo(a: i32, b: i32) i32 {
return a / b;
}
// error
// backend=stage2
// target=native
//
// :2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact