MISRAC++2023-6.2.3_b (C++ only)
In this section:
Synopsis
(Required) The source code used to implement an entity shall appear only once
Enabled by default
Yes
Severity/Certainty
Medium/Medium

Full description
Duplicate implementation of an antity found.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
// Include guards skipped for brevity.
// file1.h
template< typename T > class A {};
// file2.h
#include "file1.h"
A< int > const a1 {};
// file3.h
#include "file1.h"
template<> class A< int > {}; // Non-compliant
// main.cc
#include "file1.h"
#include "file2.h" // ODR violation
#include "file3.h"
The following code example passes the check and will not give a warning about this issue:
// Not applicable.