LLVM abort with indexing of byte string literal in static #17233
Closed
Description
#![allow(dead_code)]
const X: &'static [u8] = b"1";
static Y: u8 = X[0];
fn main() {}
rustc: /build/rust-git/src/rust/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GlobalVariable; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GlobalVariable*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted
playpen: application terminated with error code 134
Changing the b"1"
to e.g. &[1]
works fine.