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