== Why is this an issue?

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

[source,cpp]
----
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

[source,cpp]
----
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.


== Resources

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


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Explicitly invoke the template version of this function.


'''
== Comments And Links
(visible only on this page)

=== on 21 Oct 2014, 18:50:16 Ann Campbell wrote:
\[~samuel.mercier] this is an "inconsistent with developer expectations" rule, & so should probably be tied to Reliability & is also likely at least a "pitfall" if not a "bug".

endif::env-github,rspecator-view[]
