[fpc-pascal] Incompleteness of current fix for #22860

JC Chu jcchu at acm.org
Thu Sep 13 03:36:06 CEST 2012


Regarding bug #22860 on the inability to define enumeration members
using expressions containing previously defined members of the same
type, the current fix does not provide a complete solution.

The current fix won’t allow for valid declarations such as TYPE
TMyEnum = (meA, meB = 1 + meA) and TYPE TMyEnum = (meA, meB = meA xor

Forbidding all of those enumeration-related overloads, however, will
undo much of what the relaxation patch was intended for.

The compiler should expect an integer-typed constant expression after
‘=’, with a weakened type checking that takes as Ord(x) each
enumeration member x in the expression, where x must belong to the
enumeration type being declared, and must appear before the member
it’s used to define.

Since this weakening happens only within enumeration definitions, I
think it should be treated specifically.

Best regards,
JC Chu

More information about the fpc-pascal mailing list