Zero locals when the initializer might call a function

The function might fail, leaving the local uninitialized

Issue #236
This commit is contained in:
Brian Anderson 2011-09-08 13:45:12 -07:00
parent 0ea55ffdc8
commit d267e7486e
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -0,0 +1,7 @@
// error-pattern:fail
fn f() -> @int { fail; }
fn main() {
let a: @int = f();
}