2022-12-22 09:40:50 -06:00
|
|
|
// Strip out raw byte dumps to make comparison platform-independent:
|
2024-06-21 00:15:36 -05:00
|
|
|
//@ normalize-stderr-test: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
|
|
|
//@ normalize-stderr-test: "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
2021-10-05 03:55:57 -05:00
|
|
|
#![feature(never_type)]
|
2018-11-14 04:45:10 -06:00
|
|
|
|
2020-01-15 03:30:26 -06:00
|
|
|
const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
|
|
|
|
const _: &[!; 0] = unsafe { &*(1_usize as *const [!; 0]) }; // ok
|
|
|
|
const _: &[!] = unsafe { &*(1_usize as *const [!; 0]) }; // ok
|
|
|
|
const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
|
|
|
|
const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; //~ ERROR undefined behavior
|
2018-11-14 04:45:10 -06:00
|
|
|
|
|
|
|
fn main() {}
|