[fpc-pascal] Initialization of constant pointer type - bug? [was: Re: Initialization of constant record member of pointer type]

LacaK lacak at zoznam.sk
Thu Dec 17 07:45:09 CET 2020


Hello,

this compiles under FPC 3.0.4

const
   s: AnsiString = 'abc';
   p: pointer = @s[1];

but not under FPC 3.2.0
(I checked old Delphi XE and there it does not compile also)

Is it regression bug or not?

-Laco.


>
>
>>> Thank you, yes it works. I have used:
>>>
>>> const
>>>    MyConst1: AnsiString = 'abc'
>>>    MyConst2: TMyRec = (a: @MyConst1[1]);
>>
>> It doesn't compile with fpc 3.2.0 (I'm trying, without success so 
>> far, your open62541 translation).
>>
> Yes, you are right. That ^ compiles under FPC 3.0 but not under FPC 3.2
>
> I have updated test program (now compiles also under FPC 3.2)
>
> Thanks
>
> -Laco.
>
>


More information about the fpc-pascal mailing list