This is ambiguous because the two functions don't have the same signature, so the second is not an overload of the first. Let me write their signatures down right next to each other:
public func with<T>(_ initial: T, update: (inout T) throws -> Void) rethrows -> T
public func with<T: AnyObject>(_ object: T, update: (T) throws -> Void) rethrows
Note that the second with takes a different function signature for update than the first does. This means a function that is valid to pass to with<T> is not valid to pass to with<T: AnyObject>. As a result, the two functions are now just two functions with similar signatures, and so the compiler is not sure which one you want.
You can resolve this in a few ways:
Make the signatures match.
"Copying" the class doesn't hurt, and nor does passing it as inout, so you can rewrite your overload to:
In short, of course they are overloads of each other, but for the compiler to prefer the most specific one based on generic constraints, the only difference between the overloads must be the generic signature, i.e.
IMO your example should be unambiguous, as the AnyObject constrained overload should be considered more constrained than the unconstrained overload (feel free to file a bug).
The compiler however finds it to be ambiguous due to the fact that overload ranking currently only considers protocol constraints when deciding whether one declaration is "more constrained" than another.
And although AnyObject is documented as the protocol to which all class types implicitly conform, it's actually modelled in the compiler as an empty protocol composition (with a bit set to indicate AnyObject). The upshot of this is that it isn't treated as a protocol constraint when ranking and therefore doesn't count towards the "more constrained" score of an overload (but IMO it should).
The reason why it's unambiguous if the inout-ness is the same, for example:
is because the latter function's parameter list is considered a subtype of the former's parameter list, and therefore the latter is considered "more specialised". There's no subtype relation if the inout-ness of the parameters differ though, such as in your example.