diff options
Diffstat (limited to 'gcc/testsuite/rust/compile/issue-3563.rs')
-rw-r--r-- | gcc/testsuite/rust/compile/issue-3563.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/issue-3563.rs b/gcc/testsuite/rust/compile/issue-3563.rs new file mode 100644 index 0000000..46e7624 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-3563.rs @@ -0,0 +1,17 @@ +pub struct AA { + pub data: [u8; 10], +} + +impl AA { + pub const fn new() -> Self { + let mut res: AA = AA { data: [0; 10] }; + res.data[0] = 5; + res + } +} + +static mut BB: AA = AA::new(); + +fn main() { + let _ptr = unsafe { &mut BB }; +} |