Jonas,

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
meA).

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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to