Rul1 14-7-1 and explicit class instantiation - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.14 Templates (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=142) +---- Thread: Rul1 14-7-1 and explicit class instantiation (/showthread.php?tid=1658) |
Rul1 14-7-1 and explicit class instantiation - mstaron - 30-08-2023 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: Quote:8 An explicit instantiation that names a class template specialization is also an explicit instantiation of thebut these functions are never used. Example: Code: template <typename T> RE: Rul1 14-7-1 and explicit class instantiation - misra cpp - 06-11-2023 Your example is compliant, as f1 and f2 are instantiated with the explicit instantiation of Temp<int>. See para 10 in this draft standard: https://eel.is/c++draft/temp.explicit |