- if (declaration != NULL &&
- declaration->init.complete && token.type == '{') {
- assert(symbol != NULL);
- errorf(HERE, "multiple definitions of '%s %Y' (previous definition at %P)",
- is_struct ? "struct" : "union", symbol,
- &declaration->source_position);
+ if (declaration != NULL) {
+ if (declaration->parent_scope != scope &&
+ (token.type == '{' || token.type == ';')) {
+ declaration = NULL;
+ } else if (declaration->init.complete &&
+ token.type == '{') {
+ assert(symbol != NULL);
+ errorf(HERE, "multiple definitions of '%s %Y' (previous definition at %P)",
+ is_struct ? "struct" : "union", symbol,
+ &declaration->source_position);
+ declaration->scope.declarations = NULL;
+ }