summary refs log tree commit diff
path: root/src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs
blob: 77419e1132dc9ce0fd2fe1681c0d5c6feb0e0652 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-pass
#![feature(box_syntax)]

/*!
 * This is a regression test for a bug in LLVM, fixed in upstream r179587,
 * where the switch instructions generated for destructuring enums
 * represented with nullable pointers could be misoptimized in some cases.
 */

enum List<X> { Nil, Cons(X, Box<List<X>>) }
pub fn main() {
    match List::Cons(10, box List::Nil) {
        List::Cons(10, _) => {}
        List::Nil => {}
        _ => panic!()
    }
}