]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issue-1112.rs
Imported Upstream version 0.6
[rustc.git] / src / test / run-pass / issue-1112.rs
1 // Copyright 2012 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
11 // Issue #1112
12 // Alignment of interior pointers to dynamic-size types
13
14 struct X<T> {
15 a: T,
16 b: u8,
17 c: bool,
18 d: u8,
19 e: u16,
20 f: u8,
21 g: u8
22 }
23
24 pub fn main() {
25 let x: X<int> = X {
26 a: 12345678,
27 b: 9u8,
28 c: true,
29 d: 10u8,
30 e: 11u16,
31 f: 12u8,
32 g: 13u8
33 };
34 bar(x);
35 }
36
37 fn bar<T>(x: X<T>) {
38 assert!(x.b == 9u8);
39 assert!(x.c == true);
40 assert!(x.d == 10u8);
41 assert!(x.e == 11u16);
42 assert!(x.f == 12u8);
43 assert!(x.g == 13u8);
44 }