rust/src/test/run-pass/expr-block-slot.rs
Brian Anderson fbfd8552ab Return a better result from blocks. Closes issue #377
Blocks return in a copy of the result of their ending expression, not the
direct result of the ending expression, as that may be a local variable which
gets zeroed by drop_slot.
2011-05-17 00:46:56 -04:00

20 lines
200 B
Rust

// xfail-stage0
// Regression test for issue #377
fn main() {
auto a = {
auto b = tup(3);
b
};
assert a._0 == 3;
auto c = {
auto d = rec(v=3);
d
};
assert c.v == 3;
}