summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/ub-invalid-values.rs
blob: 1724a88dd3d9a7ca8b1b160e1593698b4a4871ec (plain)
1
2
3
4
5
6
7
8
9
10
11
const fn bool_cast(ptr: *const bool) { unsafe {
    let _val = *ptr as u32; //~ERROR: evaluation of constant value failed
    //~^ interpreting an invalid 8-bit value as a bool
}}

const _: () = {
    let v = 3_u8;
    bool_cast(&v as *const u8 as *const bool);
};

fn main() {}