rust/tests/compile-fail/intrinsics/write_bytes_overflow.rs
2020-04-11 11:36:55 +02:00

10 lines
224 B
Rust

// error-pattern: overflow computing total size of `write_bytes`
use std::mem;
fn main() {
let mut y = 0;
unsafe {
(&mut y as *mut i32).write_bytes(0u8, 1usize << (mem::size_of::<usize>() * 8 - 1));
}
}