2018-06-04 11:32:06 -05:00
|
|
|
#![feature(const_fn)]
|
|
|
|
|
|
|
|
type Field1 = i32;
|
|
|
|
type Field3 = i64;
|
|
|
|
|
|
|
|
union DummyUnion {
|
|
|
|
field1: Field1,
|
|
|
|
field3: Field3,
|
|
|
|
}
|
|
|
|
|
|
|
|
const UNION: DummyUnion = DummyUnion { field1: 1065353216 };
|
|
|
|
|
2018-11-06 07:17:40 -06:00
|
|
|
const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value
|
2018-06-04 11:32:06 -05:00
|
|
|
|
2018-10-01 05:52:47 -05:00
|
|
|
const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value
|
2018-06-04 11:32:06 -05:00
|
|
|
a: 42,
|
|
|
|
b: unsafe { UNION.field3 },
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Struct {
|
|
|
|
a: u8,
|
|
|
|
b: Field3,
|
|
|
|
}
|
|
|
|
|
2018-08-26 08:19:34 -05:00
|
|
|
const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR it is undefined behavior to use this value
|
2018-06-04 11:32:06 -05:00
|
|
|
b: [
|
|
|
|
21,
|
|
|
|
unsafe { UNION.field3 },
|
|
|
|
23,
|
|
|
|
24,
|
|
|
|
],
|
|
|
|
a: 42,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Struct2 {
|
|
|
|
b: [Field3; 4],
|
|
|
|
a: u8,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|