mirror of
https://github.com/cc65/cc65.git
synced 2025-02-02 15:37:58 +00:00
Merge pull request #2075 from bbbradsmith/struct-duplicate-member-error
Error for struct/union with a duplicate member
This commit is contained in:
commit
a7676bdff5
@ -793,6 +793,8 @@ static int HandleSymRedefinition (SymEntry* Sym, const Type* T, unsigned Flags)
|
||||
*/
|
||||
Error ("Redeclaration of enumerator constant '%s'", Sym->Name);
|
||||
Sym = 0;
|
||||
} else if (Flags & SC_STRUCTFIELD) {
|
||||
Error ("Duplicate member '%s'", Sym->Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
test/err/struct-duplicate-member.c
Normal file
17
test/err/struct-duplicate-member.c
Normal file
@ -0,0 +1,17 @@
|
||||
/* Ensure that a duplicate member in a struct produces an error.
|
||||
** https://github.com/cc65/cc65/issues/2015
|
||||
*/
|
||||
|
||||
struct bads {
|
||||
int a;
|
||||
int a; /* this is an error */
|
||||
};
|
||||
|
||||
union badu {
|
||||
int a, a; /* also an error */
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user