If a function and a specialization of a function template are deemed equivalent after overload resolution, the non-specialized function will be chosen over the function specialization, which may be inconsistent with developer expectations.


== Noncompliant Code Example

----
void f ( short ); // Example 1 
template <typename T> void f ( T ); // Example 2
void b ( short s )
{
  f ( s ); // Noncompliant - Calls Example 1
  f ( s + 1 ); // Noncompliant - Calls Example 2
}
----


== Compliant Solution

----
void f ( short ); // Example 1 
template <typename T> void f ( T ); // Example 2
void b ( short s )
{
  f<>( s ); // Compliant - Explicitly calls Example 2
  f<>( s + 1 ); // Compliant - Explicitly calls Example 2
}
----


== Exceptions

This rule does not apply to copy constructors or copy assignment operators.


== See

* MISRA {cpp}:2008, 14-8-2


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
