Fix division-by-zero checks on a /= 0 and b /= 0f #2558.

This commit is contained in:
Christoffer Lerno
2025-11-03 16:47:57 +01:00
parent 9b05dfdef1
commit 791cbbfb62
3 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
module test;
struct Foo
{
float val;
int ival;
}
fn int main()
{
Foo bar;
bar.val /= 0f;
bar.ival /= 0; // #error: Division by zero not allowed
return 0;
}