Skip to content

Commit 1a64684

Browse files
committed
LLVM error with unsupported expression in static initializer for const pointer in array on macOS
1 parent 4b55fe1 commit 1a64684

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! LLVM error with unsupported expression in static
2+
//! initializer for const pointer in array on macOS.
3+
//!
4+
//! Regression test for <https://github.com/rust-lang/rust/issues/89225>.
5+
6+
//@ build-pass
7+
//@ compile-flags: -C opt-level=3
8+
9+
const fn make() -> (i32, i32, *const i32) {
10+
const V: i32 = 123;
11+
&V as *const i32;
12+
(0, 0, &V)
13+
}
14+
15+
fn main() {
16+
let arr = [make(); 32];
17+
println!("{}", arr[0].0);
18+
}

0 commit comments

Comments
 (0)