Template argument deduction for 'char*'
<p>I have below function (Just for reproducing the issue):</p>

<pre><code>template &lt;typename KeyT&gt;
void func(const KeyT cptr) {
  std::cout &lt;&lt; typeid(KeyT).name() &lt;&lt; std::endl;
}
</code></pre>

<p>I would like to call this with a string literal, like below:</p>

<pre><code>func&lt;char*&gt;("literal");
</code></pre>

<p>But, I end up getting below warning:</p>

<pre>
warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wc++11-compat-deprecated-writable-strings]
</pre>

<p>I have a specific need to use <code>char*</code> as my Key type and I was expecting <code>TAD</code> to consider the <code>param type</code> as <code>const char*</code> in whole as I am not taking it by reference.</p>

<p>The warning comes with both <code>clang</code> and <code>g++</code> compilers.</p>

<p>How is the <code>param type</code> being deduced here ?</p>

<p>Thanks in advance.</p>