gcc/testsuite/rust/compile/torture/block_expr5.rs
raw| 1 | fn foo() -> i32 { |
| 2 | 0 |
| 3 | } |
| 4 | |
| 5 | fn bar() -> i32 { |
| 6 | foo(); |
| 7 | foo() |
| 8 | } |
| 9 | |
| 10 | fn baz() -> i32 { |
| 11 | { |
| 12 | bar(); |
| 13 | bar(); |
| 14 | } |
| 15 | { |
| 16 | bar(); |
| 17 | bar() |
| 18 | }; |
| 19 | { |
| 20 | bar(); |
| 21 | bar() |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | fn test(ok: i32) -> i32 { |
| 26 | if ok >= 1 { |
| 27 | foo() |
| 28 | } else if ok <= -1 { |
| 29 | bar() |
| 30 | } else { |
| 31 | baz() |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | fn main() { |
| 36 | let a = foo(); |
| 37 | let b = bar(); |
| 38 | let c = baz(); |
| 39 | test(a + b + c); |
| 40 | } |