Skip to content

Commit

Permalink
Allow function pointers in CValue::const_val
Browse files Browse the repository at this point in the history
Fixes #1430
  • Loading branch information
bjorn3 committed Nov 24, 2023
1 parent a5fcfad commit 430ab4e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,13 @@ impl<'tcx> CValue<'tcx> {
let msb = fx.bcx.ins().iconst(types::I64, (const_val >> 64) as u64 as i64);
fx.bcx.ins().iconcat(lsb, msb)
}
ty::Bool | ty::Char | ty::Uint(_) | ty::Int(_) | ty::Ref(..) | ty::RawPtr(..) => {
ty::Bool
| ty::Char
| ty::Uint(_)
| ty::Int(_)
| ty::Ref(..)
| ty::RawPtr(..)
| ty::FnPtr(..) => {
let raw_val = const_val.size().truncate(const_val.to_bits(layout.size).unwrap());
fx.bcx.ins().iconst(clif_ty, raw_val as i64)
}
Expand Down

0 comments on commit 430ab4e

Please sign in to comment.