Rule 14–7–3 Example errata?

Moderators: david ward, misra cpp

Post Reply
minhyuk
Posts: 5
Joined: Wed Feb 06, 2013 1:51 am
Company: Suresoft Technologies

Rule 14–7–3 Example errata?

Post by minhyuk » Thu Feb 07, 2013 11:58 pm

See 14-7-3 Example:

a function template specialization for good_tmp1 violated ODR in tmp1.cc.

Code: Select all

// tmp1.h
template <> void good_tmp1<int32_t> ( ) { }

// tmp1.cc
#include "tmp1.h"
template <> void good_tmp1<int32_t> ( ) { }
I think function template specialization must be forward declaration in header file.
any reason for that?

Best Regards,
Minhyuk [email protected] technologies Incs.

misra cpp
Posts: 148
Joined: Mon Jun 02, 2008 1:55 pm
Company: MISRA

Re: Rule 14–7–3 Example errata?

Post by misra cpp » Tue Oct 11, 2016 11:09 am

You are correct, the declaration in the header file should be non-defining. This will be corrected in a Technical Corrigendum
Posted by and on behalf of
the MISRA C++ Working Group

Post Reply

Return to “6.14 Templates (C++)”