blob: 3229293fd7a46c4203dc4d250b7f4cfb36cd4f79 [file] [log] [blame]
Jed Davis30aae3d2013-01-31 01:51:571// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
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
11enum E { V16(u16), V32(u32) }
12struct S { a: E, b: u16, c: u16 }
Patrick Walton85c9fc62013-03-22 21:00:1513static C: S = S { a: V16(0xDEAD), b: 0x600D, c: 0xBAD };
Jed Davis30aae3d2013-01-31 01:51:5714
Jed Davis9939d882013-02-17 22:36:4315pub fn main() {
Jed Davis30aae3d2013-01-31 01:51:5716 let n = C.b;
Patrick Walton1e915952013-03-29 01:39:0917 assert!(n != 0xBAD);
Corey Richardsoncc57ca02013-05-19 02:02:4518 assert_eq!(n, 0x600D);
Jed Davis30aae3d2013-01-31 01:51:5719}