protocol P {} func f<T: P>(_ p: T) {} let int = 0 f(int as! P) // error: cannot invoke 'f' with an argument list of type '(P)'
ぬうう (edited)protocol P {} func f<T: P>(_ p: T) {} func f2(_ any: Any) { if let p = any as? P { f(p) // error: cannot invoke 'f' with an argument list of type '(P)' } }