summaryrefslogtreecommitdiffstats
path: root/tests/ui/ptr_ops/issue-80309.rs
blob: c13ce3c9cd2c1d2f21e677cbf412efd03e246ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass
// compile-flags: -O

// Regression test for issue #80309

pub unsafe fn foo(x: *const i8) -> i8 {
    *x.wrapping_sub(x as _).wrapping_add(x as _)
}

fn main() {
    let x = 42;
    println!("{}", unsafe { foo(&x) });
}