commit b2e94de3585e0a1242e3a5d6c8fd331da9f2d4f5 (tree) parent ebd082d3f6813f1d919ed1c1886fdc58b9d31b7d Author: Andrew Kelley <andrew@ziglang.org> Date: Tue, 13 Sep 2022 10:01:17 -0700 add compile error test for pointless discards Diffstat:
| A | test/cases/compile_errors/pointless discard.zig | | | 12 | ++++++++++++ |
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/test/cases/compile_errors/pointless discard.zig b/test/cases/compile_errors/pointless discard.zig @@ -0,0 +1,12 @@ +export fn foo() void { + var x: i32 = 1234; + x += 1; + _ = x; +} + +// error +// backend=stage2 +// target=native +// +// :4:9: error: pointless discard of local variable +// :3:5: note: used here