]>
Commit | Line | Data |
---|---|---|
54a0048b | 1 | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT |
223e47cc LB |
2 | // file at the top-level directory of this distribution and at |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
b7449926 XL |
11 | // run-pass |
12 | ||
9e0c209e SL |
13 | union U { |
14 | a: u64, | |
15 | b: u64, | |
54a0048b | 16 | } |
223e47cc | 17 | |
9e0c209e SL |
18 | const C: U = U { b: 10 }; |
19 | ||
970d7e83 | 20 | fn main() { |
9e0c209e SL |
21 | unsafe { |
22 | let a = C.a; | |
23 | let b = C.b; | |
24 | assert_eq!(a, 10); | |
25 | assert_eq!(b, 10); | |
26 | } | |
223e47cc | 27 | } |