Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Feb 13, 2024
1 parent 9aa232e commit 7ec9601
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/mir-opt/issue_120925_unsafefncast.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Verify that we do not ICE when attempting to interpret casts between fn types.
// skip-filecheck

static FOO: fn() = || assert_ne!(42, 43);
static BAR: fn(i32, i32) = |a, b| assert_ne!(a, b);

fn main() {
FOO();

let bar: unsafe fn(i32, i32) = BAR;

let f: fn() = || {};
f();

f();

f();

let g: fn(i32) = |i| assert_eq!(i, 2);
g(2);

g(2);

g(2);
}

0 comments on commit 7ec9601

Please sign in to comment.