mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-02 04:31:25 +00:00
Do not treat uses of enum types from outer scopes as redeclarations.
This affects code like the following: enum E {a,b,c}; int main(void) { enum E e; struct E {int x;}; /* or: enum E {x,y,z}; */ } The line "enum E e;" should refer to the enum type declared in the outer scope, but not redeclare it in the inner scope. Therefore, a subsequent struct, union, or enum declaration using the same tag in the same scope is acceptable.
This commit is contained in:
parent
fd54fd70d0
commit
6d07043783
@ -3181,9 +3181,10 @@ while token.kind in allowedTokens do begin
|
||||
Error(143);
|
||||
NextToken; {skip the 'enum' token}
|
||||
if token.kind in [ident,typedef] then begin {handle a type definition}
|
||||
variable := FindSymbol(token, tagSpace, true, true);
|
||||
ttoken := token;
|
||||
NextToken;
|
||||
variable :=
|
||||
FindSymbol(ttoken, tagSpace, token.kind = lbracech, true);
|
||||
if variable <> nil then
|
||||
if variable^.itype^.kind = enumType then
|
||||
if token.kind <> lbracech then
|
||||
|
2
cc.notes
2
cc.notes
@ -1895,6 +1895,8 @@ int foo(int[42]);
|
||||
|
||||
205. Using the same identifier as a typedef name and then as the tag for an enum would cause a spurious error.
|
||||
|
||||
206. If an enum type defined in an outer scope was used in an inner scope, and then a new struct, union, or enum type was declared with the same tag in the same inner scope, a spurious error was reported.
|
||||
|
||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||
|
||||
1. In some situations, fread() reread the first 1K or so of the file.
|
||||
|
Loading…
Reference in New Issue
Block a user