title: Generic parameter 'T' could not be inferred / Cannot explicitly specialize a generic function
body: <p>I have a function with this signature written in a Swift project in Xcode 7.3.1:</p>
  
  <pre><code>func DLog&lt;T&gt;(@autoclosure object: () -&gt; T, _ file: String = #file, _ function: String = #function, _ line: Int = #line) {
  }
  </code></pre>
  
  <p>The compiler complains about <code>Generic parameter 'T' could not be inferred</code> for this call:</p>
  
  <pre><code>DLog({ var text = "Returning output list\n"; for outline in outlines { text = text + outline.debugDescription + "\n"; }; return text; })
  </code></pre>
  
  <p>When I try to provide the type it complains <code>Cannot explicitly specialize a generic function</code>:</p>
  
  <pre><code>DLog&lt;String&gt;({ var text = "Returning output list\n"; for outline in outlines { text = text + outline.debugDescription + "\n"; }; return text; })
  </code></pre>
  
  <p>I have tried few more approaches but nothing satisfied the compiler. I have also failed to find a hint how to solve this case.</p>
  
  <p>How to build the text inside the <code>() =&gt; T</code> argument and pass it to the function properly?</p>