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