You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C Struct/union/enum tags follow the same rules than other identifiers for scope. They may be redeclared in an inner scope and the inner declaration hides the outer ones.
The following legal code is reported as erroneous :
void f(int n) {
struct S { int a; };
if (n == 10) {
struct S { int b; } s; // error "multiple definitions"
s.b = 1;
}
s.a = 2;
}
4: struct S { int b; } s;
^ Multiple definitions
2020-01-22 00:37:59,248 | INFO | root | ppci 0.5.7 on CPython 3.6.9 on Linux
2020-01-22 00:37:59,254 | INFO | cbuilder | Starting C compilation (c99)
2020-01-22 00:37:59,256 | ERROR | root | Multiple definitions
2020-01-22 00:37:59,257 | ERROR | root | (bug20.c, 5, 5)
Same behaviour for union/enum (which share the tag namespace)
The text was updated successfully, but these errors were encountered:
C Struct/union/enum tags follow the same rules than other identifiers for scope. They may be redeclared in an inner scope and the inner declaration hides the outer ones.
The following legal code is reported as erroneous :
Same behaviour for union/enum (which share the tag namespace)
The text was updated successfully, but these errors were encountered: