<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class="">On Dec 5, 2016, at 11:39 AM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">On Dec 4, 2016, at 6:46 PM, Charles Srstka via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">The following currently does not work:<br class=""><br class="">protocol P: class {}<br class="">class C: P {}<br class=""><br class="">func foo<T>(t: T) where T: AnyObject {<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>print("foo")<br class="">}<br class=""><br class="">let p: P = C()<br class=""><br class="">foo(t: p) // error: cannot invoke 'foo' with an argument list of type '(t: P)'<br class=""><br class="">It seems to me that this ought to have been allowed, since P is declared as being a reference type and thus should have been able to satisfy the function’s requirements.<br class=""><br class="">Is this worthy of writing a language proposal, or would this be considered a bug that should be sent through the radar system instead?<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It's a limitation of the current implementation. `AnyObject` is taken as meaning that a conforming type has a representation that consists of a single refcounted pointer. Protocol existentials do not have a single-refcounted representation since the witness table for the conformances must also be carried around, therefore the protocol type does not conform to AnyObject's representation requirement.</span></div></div></blockquote></div><br class=""><div class="">Is there any way to just say “This function takes any reference type” that will work?</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div></body></html>