MISRAC2012-Rule-5.7
In this section:
Synopsis
(Required) A tag name shall be a unique identifier.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
A class, struct, union, or enum declaration clashes with a previous declaration. This check is identical to MISRAC2004-5.4, MISRAC++2008-2-10-4.
This is a link analysis check.
Coding standards
- MISRA C:2004 5.4
(Required) A tag name shall be a unique identifier.
- MISRA C:2012 Rule-5.7
(Required) A tag name shall be a unique identifier
- MISRA C++ 2008 2-10-4
(Required) A class, union or enum name (including qualification, if any) shall be a unique identifier.
Code examples
The following code example fails the check and will give a warning:
void f1()
{
class TYPE {};
}
void f2()
{
float TYPE; // non-compliant
}
The following code example passes the check and will not give a warning about this issue:
void f1()
{
class TYPE {};
}
void f2()
{
float a_type;
}