2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2011-11-01 14:10:46 -05:00
|
|
|
// Issue #1112
|
|
|
|
// Alignment of interior pointers to dynamic-size types
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
struct X<T> {
|
2011-11-01 14:10:46 -05:00
|
|
|
a: T,
|
|
|
|
b: u8,
|
|
|
|
c: bool,
|
|
|
|
d: u8,
|
|
|
|
e: u16,
|
|
|
|
f: u8,
|
|
|
|
g: u8
|
2013-01-26 00:46:32 -06:00
|
|
|
}
|
2011-11-01 14:10:46 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2015-03-25 19:06:52 -05:00
|
|
|
let x: X<isize> = X {
|
2011-11-01 14:10:46 -05:00
|
|
|
a: 12345678,
|
2015-03-03 02:42:26 -06:00
|
|
|
b: 9,
|
2011-11-01 14:10:46 -05:00
|
|
|
c: true,
|
2015-03-03 02:42:26 -06:00
|
|
|
d: 10,
|
|
|
|
e: 11,
|
|
|
|
f: 12,
|
|
|
|
g: 13
|
2011-11-01 14:10:46 -05:00
|
|
|
};
|
|
|
|
bar(x);
|
|
|
|
}
|
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn bar<T>(x: X<T>) {
|
2015-03-03 02:42:26 -06:00
|
|
|
assert_eq!(x.b, 9);
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(x.c, true);
|
2015-03-03 02:42:26 -06:00
|
|
|
assert_eq!(x.d, 10);
|
|
|
|
assert_eq!(x.e, 11);
|
|
|
|
assert_eq!(x.f, 12);
|
|
|
|
assert_eq!(x.g, 13);
|
2012-12-13 15:05:22 -06:00
|
|
|
}
|