add regression test for #74739 (mir const-prop bug)

This commit is contained in:
Ralf Jung 2020-08-12 12:50:24 +02:00
parent 5989bf4872
commit 0d6ff997a5

View file

@ -0,0 +1,14 @@
// compile-flags: -O
// run-pass
struct Foo {
x: i32,
}
pub fn main() {
let mut foo = Foo { x: 42 };
let x = &mut foo.x;
*x = 13;
let y = foo;
assert_eq!(y.x, 13); // used to print 42 due to mir-opt bug
}