2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2015-01-08 05:02:42 -06:00
|
|
|
struct S { a: usize }
|
2018-05-27 11:07:23 -05:00
|
|
|
|
2018-05-28 19:38:18 -05:00
|
|
|
static A: S = S { a: 3 };
|
2015-01-08 05:02:42 -06:00
|
|
|
static B: &'static usize = &A.a;
|
|
|
|
static C: &'static usize = &(A.a);
|
2014-10-06 23:16:35 -05:00
|
|
|
|
2015-01-08 05:02:42 -06:00
|
|
|
static D: [usize; 1] = [1];
|
|
|
|
static E: usize = D[0];
|
|
|
|
static F: &'static usize = &D[0];
|
2014-10-06 23:16:35 -05:00
|
|
|
|
2018-05-28 19:38:18 -05:00
|
|
|
fn main() {
|
|
|
|
assert_eq!(*B, A.a);
|
|
|
|
assert_eq!(*B, A.a);
|
|
|
|
|
|
|
|
assert_eq!(E, D[0]);
|
|
|
|
assert_eq!(*F, D[0]);
|
|
|
|
}
|