 <p>Function specialization is weird and almost non-existent. It's possible to fully specialize a function, while retaining all types - i.e. you're providing a custom implementation of some specialization of the existing function. You can not partially specialize a templated function.</p> <p>It's likely that what you're trying to do can be achieved with overloading, i.e.:</p> <pre><code>template &lt;typename T&gt; T foo(T arg) { return T(); } float foo(int arg) { return 1.f; } </code></pre>