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

2020-12-14 Thread Marc Weustink via fpc-pascal
On 4-12-2020 13:01, LacaK via fpc-pascal wrote: Dňa 2.12.2020 o 16:09 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-02 16:01, LacaK via fpc-pascal wrote: Dňa 2.12.2020 o 13:55 Tomas Hajny via fpc-pascal napísal(a): On 2020-12-01 11:39, Ladislav Karrach via fpc-pascal wrote: Because My

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

2020-12-14 Thread Luca Olivetti via fpc-pascal
El 1/12/20 a les 11:00, LacaK via fpc-pascal ha escrit: 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). In order to comp

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

2020-12-14 Thread LacaK via fpc-pascal
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

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

2020-12-14 Thread LacaK via fpc-pascal
Because MyConst1 is not an *untyped* constant. Only untyped constants can be used in constant expressions (a pointer to something can be considered an untyped constant). The following might work though I did not test it: === code begin === const    MyStr = 'abc'    MyConst1: AnsiString =