<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">I do think there is something wrong here.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">// Xcode 7.3.1, Swift 2.2</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default"><div class="gmail_default"><font face="georgia, serif">let t1: Int? = 2 // struct Int?</font></div><div class="gmail_default"><font face="georgia, serif">let y = t1 ?? &quot;abcdf&quot; // error</font></div><div class="gmail_default"><font face="georgia, serif">let x = t1 ?? NSFont(name: &quot;&quot;, size: 0) // x: NSObject?</font></div><div class="gmail_default"><font face="georgia, serif"><br></font></div><div class="gmail_default"><font face="georgia, serif">for x, how could it be NSObject?, as t1 is a struct?</font></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="georgia, serif">zhaoxin</font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 18, 2016 at 6:59 PM, Marco Feltmann via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class="">
    Am 18.04.2016 um 11:51 schrieb tuuranton--- via swift-users:<br>
    <blockquote type="cite">
      <pre>Why does this compile?
let t1: Int? = 2print(t1 ?? &quot;asdf&quot;)
</pre>
    </blockquote></span>
    Well, I guess you try to re-typedef (??) a language construct.<br>
    According to NSHipster ?? is the languages <code>nil</code>
    coalescing operator.<br>
    <br>
    So it simply compiles because t1 isn&#39;t nil.<br>
    <br>
    Further reference:<br>
    <a href="https://en.wikipedia.org/wiki/Null_coalescing_operator#Swift" target="_blank">https://en.wikipedia.org/wiki/Null_coalescing_operator#Swift</a><br>
  </div>

<br>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>