Trailing Closure Overload Weirdness

For a few years, I've noticed that there's an unfortunate ambiguity when writing overloads of the form:

func with<T>(_ initial: T, update: (inout T) -> ()) -> () { ... }
func with<T: AnyObject>(_ object, body: (T) -> ()) -> () { ... }

I had thought this had applied to all functions that are overloaded on an AnyObject constraint, but apparently this only causes ambiguous overloads for functions that also have trailing closure parameters. Does anyone have an idea of why the trailing closures break overload resolution in these cases?

Example Code
func foo<T>(_ bar: T) {
    print("Foo<T>")
}

func foo<T: AnyObject>(_ bar: T) {
    print("Foo<T: AnyObject>")
}

final class Func {
    func callAsFunction() {
        print("Func")
    }
}

func with<T>(_ initial: T, update: (inout T) -> ()) -> T {
    var object = initial
    update(&object)
    return object
}

func with<T: AnyObject>(_ object: T, body: (T) -> ()) -> T {
    body(object)
    return object
}

do {
    // These two work fine. No ambiguity.
    foo("bar")
    foo(Func())
    // So does this one.
    print(with("bar") { $0 = "foobar" })
    // Error: Ambiguous overload
    print(with(Func()) { $0() })
}