github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/test/execution/functions/unreachable.go (about) 1 // RUN: llgo -o %t %s 2 // RUN: %t 2>&1 | FileCheck %s 3 4 // CHECK: f1 5 // CHECK-NEXT: f2 6 // CHECK-NEXT: f3 7 // CHECK-NEXT: f4 8 // CHECK-NEXT: 123 9 10 package main 11 12 func f1() { 13 if true { 14 println("f1") 15 return 16 } 17 for { 18 } 19 } 20 21 func f2() { 22 defer func() { println("f2") }() 23 if true { 24 return 25 } 26 for { 27 } 28 } 29 30 func f3() int { 31 if true { 32 println("f3") 33 return 123 34 } 35 for { 36 } 37 } 38 39 func f4() int { 40 defer func() { println("f4") }() 41 if true { 42 return 123 43 } 44 for { 45 } 46 } 47 48 func main() { 49 f1() 50 f2() 51 f3() 52 println(f4()) 53 }