Allow the same identifier to be used as a typedef and an enum tag.

This should be allowed (because they are in separate name spaces), but was not.

This affected code like the following:

typedef int T;
enum T {a,b,c};
This commit is contained in:
Stephen Heumann 2022-07-18 18:33:54 -05:00
parent bdf8ed4f29
commit 2cbcdc736c
2 changed files with 3 additions and 1 deletions

View File

@ -3180,7 +3180,7 @@ while token.kind in allowedTokens do begin
else if restrictsy in myDeclarationModifiers then
Error(143);
NextToken; {skip the 'enum' token}
if token.kind = ident then begin {handle a type definition}
if token.kind in [ident,typedef] then begin {handle a type definition}
variable := FindSymbol(token, tagSpace, true, true);
ttoken := token;
NextToken;

View File

@ -1893,6 +1893,8 @@ int foo(int[42]);
204. Calling lseek() with a whence value of 2 and a negative offset should seek to a location before the end of the file, but it would not actually do so. (The problem was that lseek effectively negated the specified offset if whence was 2. It has been changed to avoid the negation. If any code relied on the old behavior by using a whence value of 2 with a positive offset to seek before the end of the file, it should be changed to use a negative offset instead.)
205. Using the same identifier as a typedef name and then as the tag for an enum would cause a spurious error.
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
1. In some situations, fread() reread the first 1K or so of the file.