title: Function template with return type T doesn't compile
body: <p>The following code compiles fine:</p>
  
  <pre><code>template&lt;typename T&gt;
  void f(const T &amp;item) { return; }
  
  int main() 
  {
    f("const string literal");
  }
  </code></pre>
  
  <p>Compilation succeeded at ideone : <a href="http://ideone.com/dR6iZ" rel="noreferrer">http://ideone.com/dR6iZ</a></p>
  
  <p>But when I mention the return type, it doesn't compile:</p>
  
  <pre><code>template&lt;typename T&gt;
  T f(const T &amp;item) { return item; }
  
  int main() 
  {
    f("const string literal");
  }
  </code></pre>
  
  <p>Now it gives error:</p>
  
  <blockquote>
    <p>prog.cpp:6: error: no matching function for call to ‘f(const char [21])’</p>
  </blockquote>
  
  <p>Code at ideone : <a href="http://ideone.com/b9aSb" rel="noreferrer">http://ideone.com/b9aSb</a></p>
  
  <p>Even if I make the return type <code>const T</code>, it <a href="http://ideone.com/Bt3mF" rel="noreferrer">doesn't compile</a>.</p>
  
  <p>My question is : </p>
  
  <ul>
  <li>Why does it not compile?</li>
  <li>What does the return type has to do with the error and the function template instantiation?</li>
  </ul>