Does this rule should detect functions in template classes, that have no instances, but the class is explicitly instantiated?
In this case member functions are instantiated accordingly to the C++ standard:
Example:
In this case member functions are instantiated accordingly to the C++ standard:
Quote:8 An explicit instantiation that names a class template specialization is also an explicit instantiation of thebut these functions are never used.
same kind (declaration or definition) of each of its members (not including members inherited from base
classes and members that are templates) that has not been previously explicitly specialized in the translation
unit containing the explicit instantiation, except as described below. [ Note: In addition, it will typically be
an explicit instantiation of certain implementation-dependent data about the class. —end note ]
9 An explicit instantiation definition that names a class template specialization explicitly instantiates the class
template specialization and is an explicit instantiation definition of only those members that have been
defined at the point of instantiation.
Example:
Code:
template <typename T>
class Temp {
public:
void f1(){} // Compliant?
void f2(){} // Compliant?
};
template class Temp<int>;