Add missing case for pointer -> int when translating constant cast expressions

Closes issue #17458
This commit is contained in:
Brian Koropoff 2014-09-29 19:58:32 -07:00
parent 0c66796525
commit 293b57701b

View file

@ -547,6 +547,9 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr,
(expr::cast_integral, expr::cast_pointer) => {
llvm::LLVMConstIntToPtr(v, llty.to_ref())
}
(expr::cast_pointer, expr::cast_integral) => {
llvm::LLVMConstPtrToInt(v, llty.to_ref())
}
_ => {
cx.sess().impossible_case(e.span,
"bad combination of types for cast")