mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
add compile error test for pointless discards
This commit is contained in:
parent
ebd082d3f6
commit
b2e94de358
12
test/cases/compile_errors/pointless discard.zig
Normal file
12
test/cases/compile_errors/pointless discard.zig
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user