Violation of the One Definition Rule (ISO/IEC 14882:2003, §3.2) leads to undefined behaviour. In general, this means that the program shall contain exactly one definition of every non-inline function or object.


Additionally:

* The definitions of a type shall consist of the same sequence of tokens, and;
* The definitions of a template shall consist of the same sequence of tokens, and;
* The definitions of an inline function shall consist of the same sequence of tokens.

Note that for the purposes of this rule, typedefs shall be treated as types.


== Noncompliant Code Example

----
// File a.cpp
struct S1
{
  int32_t i;
};

struct S2
{
  int32_t i;
};

// File b.cpp 
struct S1
{
  int64_t i;
}; // Noncompliant, token sequence different

struct S2
{
 int32_t i;
 int32_t j;
}; // Noncompliant, token sequence different
----


== See

* MISRA {cpp}:2008, 3-2-2
* ISO/IEC 14882:2003, §3.2
* https://wiki.sei.cmu.edu/confluence/x/IXs-BQ[CERT, DCL60-CPP.] - Obey the one-definition rule

