Closed
Description
extern fn plusone(u: u8) -> u8 {
return u + 1;
}
struct S {
fun: *u8
}
const s: S = S { fun: plusone };
This code does not give any compile errors from rustc, but triggers an assertion in LLVM: "Initializer for struct element doesn't match struct element type!".
Full error message:
rustc: .../rust/src/llvm/lib/VMCore/Constants.cpp:812: llvm::ConstantStruct::ConstantStruct(llvm::StructType*, llvm::ArrayRef<llvm::Constant*>): Assertion `(T->isOpaque() || V[i]->getType() == T->getElementType(i)) && "Initializer for struct element doesn't match struct element type!"' failed.```