MISRAC++2023-6.2.1
In this section:
Synopsis
(Required) The one-definition rule shall not be violated
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
Found entity with multiple definitions. This check is identical to MISRAC++2008-3-2-2.
This is a link analysis check.
Coding standards
- MISRA C++ 2008 3-2-2
(Required) The One Definition Rule shall not be violated.
Code examples
The following code example fails the check and will give a warning:
// File 1
struct S1 {
int i;
};
// File 2
struct S1 {
float i;
};
The following code example passes the check and will not give a warning about this issue:
// File 1
struct S1i {
int i;
};
// File 2
struct S1f {
float i;
};