AstGen: disallow '-0' integer literal

The intent here is ambiguous: this resolves to the comptime_int '0', but
it's likely the user meant to use a floating-point literal.

Resolves: #16890
This commit is contained in:
mlugg
2023-08-21 02:27:11 +01:00
committed by Veikka Tuominen
parent 411462e1cd
commit 283afb50b5
5 changed files with 22 additions and 18 deletions

View File

@@ -0,0 +1,11 @@
export fn foo() void {
_ = -0;
}
// error
// backend=stage2
// target=native
//
// :2:10: error: integer literal '-0' is ambiguous
// :2:10: note: use '0' for an integer zero
// :2:10: note: use '-0.0' for a floating-point signed zero