auto merge of #6848 : pcwalton/rust/issue-6352, r=pcwalton
r? @nikomatsakis
This commit is contained in:
commit
6fcb483609
2 changed files with 15 additions and 0 deletions
|
@ -563,6 +563,7 @@ fn build_const_struct(ccx: @CrateContext, st: &Struct, vals: &[ValueRef])
|
||||||
vals[i]
|
vals[i]
|
||||||
};
|
};
|
||||||
cfields.push(val);
|
cfields.push(val);
|
||||||
|
offset += machine::llsize_of_alloc(ccx, llty) as u64
|
||||||
}
|
}
|
||||||
|
|
||||||
return cfields;
|
return cfields;
|
||||||
|
|
14
src/test/run-pass/const-struct-offsets.rs
Normal file
14
src/test/run-pass/const-struct-offsets.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
enum Foo {
|
||||||
|
IntVal(i32),
|
||||||
|
Int64Val(i64)
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar {
|
||||||
|
i: i32,
|
||||||
|
v: Foo
|
||||||
|
}
|
||||||
|
|
||||||
|
static bar: Bar = Bar { i: 0, v: IntVal(0) };
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue