Hi all,

Could someone please tell me why the following fails?

func foo(f: () throws -> () = {}) rethrows {
    try f()
}

// Fine
foo({ })

// This fails with error:
//    call is to 'rethrows' function,
//    but a defaulted argument function can throw
foo()

Why should I have to write "try foo()", shouldn't it take the default value
(non throwing closure)?

Regards,
Bhargav Gurlanka
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to