1
Fork 0

Fix transmuting fat pointers to integers

Fixes #1325
This commit is contained in:
bjorn3 2023-06-19 20:55:55 +00:00
parent ece98a4b41
commit ab836ca5e3
2 changed files with 21 additions and 1 deletions

View file

@ -155,12 +155,25 @@ fn main() {
}
foo(I64X2(0, 0));
transmute_fat_pointer();
}
fn panic(_: u128) {
panic!();
}
use std::mem::transmute;
#[cfg(target_pointer_width = "32")]
type TwoPtrs = i64;
#[cfg(target_pointer_width = "64")]
type TwoPtrs = i128;
fn transmute_fat_pointer() -> TwoPtrs {
unsafe { transmute::<_, TwoPtrs>("true !") }
}
#[repr(simd)]
struct I64X2(i64, i64);