Zero locals when the initializer might call a function
The function might fail, leaving the local uninitialized Issue #236
This commit is contained in:
parent
0ea55ffdc8
commit
d267e7486e
@ -4520,6 +4520,7 @@ fn visit_expr(ex: &@ast::expr, e: &env, v: &vt<env>) {
|
||||
ast::expr_ret(_) { true }
|
||||
ast::expr_break. { true }
|
||||
ast::expr_cont. { true }
|
||||
ast::expr_call(_, _) { true }
|
||||
_ {
|
||||
let ex_ty = ty::expr_ty(e.ccx.tcx, ex);
|
||||
ty::type_is_bot(e.ccx.tcx, ex_ty)
|
||||
|
7
src/test/run-fail/unwind-initializer-indirect.rs
Normal file
7
src/test/run-fail/unwind-initializer-indirect.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// error-pattern:fail
|
||||
|
||||
fn f() -> @int { fail; }
|
||||
|
||||
fn main() {
|
||||
let a: @int = f();
|
||||
}
|
Loading…
Reference in New Issue
Block a user