Skip to content

Commit 845c676

Browse files
committed
LLVM error with unsupported expression in static initializer for const pointer in array on macOS
1 parent 924a5a4 commit 845c676

File tree

1 file changed

+17
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)