summary refs log tree commit diff
path: root/src/test/compile-fail/ctor-uninit-var.rs
blob: b2af5e48f0133a97f61f012c2ab41bfe56dd7576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// error-pattern:unsatisfied precondition
class cat {
  priv {
    let mutable meows : uint;
  }

  let how_hungry : int;

  fn eat() {
    how_hungry -= 5;
  }

  new(in_x : uint, in_y : int) {
    let foo;
    meows = in_x + (in_y as uint);
    how_hungry = foo;
  }
}

fn main() {
  let nyan : cat = cat(52u, 99);
  nyan.eat();
}