summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-18845.rs
blob: 83fab4b5e8febd905b69ae92b174f7e88413857d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
// This used to generate invalid IR in that even if we took the
// `false` branch we'd still try to free the Box from the other
// arm. This was due to treating `*Box::new(9)` as an rvalue datum
// instead of as a place.

fn test(foo: bool) -> u8 {
    match foo {
        true => *Box::new(9),
        false => 0
    }
}

fn main() {
    assert_eq!(9, test(true));
}