[previous] 0547 [next] [C] This declaration of tag '%s' conflicts with a previous declaration.
Constraint violations REFERENCE - ISO:C90-6.5 Declarations - Constraints, ISO:C90-6.5.2.3 Tags

This is a constraint error

This tag has already been declared within the same scope.

The same tag cannot be used to declare a struct as well as a union (or an enum) because there is only a single name space for all tags. Nor is it permitted to declare the same tag more than once even when the declarations are identical.

For example:


/*PRQA S 553,750,2017,3132,3602,3625 ++*/

struct RECORD1
{
   unsigned int  number;
};

union RECORD1                     /* Message 0547 */
{
   unsigned int  number;
   unsigned char n[4];
};

struct RECORD2
{
   int         size;
   signed char sca[20];
};

struct RECORD2                    /* Message 0547 */
{
   int         size;
   signed char sca[20];
};                                /* Message 0653 */


struct RECORD3
{
   int  n;
   char buf[20];
};

struct RECORD3                    /* Message 0547 */
{
   int  n;
   int  buf[21];
};                                /* Message 0653 */


See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents