blob: c9dc175b10a8ad4eae31933c668eb1cf042f4e2c (
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));
}
|