Created
July 30, 2014 15:24
-
-
Save mattneary/5848c03f12c246057b2a to your computer and use it in GitHub Desktop.
Nested Recursive Functions Broken in Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func run() -> Int { | |
func fact(n : Int) -> Int { | |
return n == 0 ? 1 : n * fact(n-1) | |
} | |
return fact(3) | |
} | |
println(run()) | |
// Gives the following error: | |
// Instruction does not dominate all uses! | |
// %2 = bitcast %Si* %0 to %swift.opaque* | |
// %3 = ptrtoint %swift.opaque* %2 to i64 | |
// LLVM ERROR: Broken function found, compilation aborted! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment