[fpc-devel] Enum values and scope

Sven Barth pascaldragon at googlemail.com
Wed Nov 6 15:40:58 CET 2013


Am 06.11.2013 15:06, schrieb Martin:
> The below compiles. (2.6.2)
>
> It shows that the value identifier of an enum, can be reached via a 
> lot of different pathes.
>
> Just want to be sure they are all intentional?
>
>
> unit Unit1;
> {$mode objfpc}{$H+}
> interface
> uses  Classes, SysUtils;
>
> type  TEnum = (e1,e2,e3);
> var   en1: TEnum;
>
> implementation
> procedure Foo;
> begin
>   en1 := Unit1.e1;
>   en1 := TEnum.e1;
>   en1 := Unit1.TEnum.e1;
Yes, all three intentional.
>   en1 := en1.e1;
>   en1 := Unit1.en1.e1;
Not intentional and already fixed in 2.7.1 (don't know whether this was 
merged back to 2.6.x though)
> end;
>
> end.
Regards,
Sven



More information about the fpc-devel mailing list