Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-03

FPC 3.0.0 and constref default param

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

This code worked fine on FPC 2.6.4:

procedure Test(constref AParam: String = 'def_param');
begin
  writeln(AParam);
end;

But on FPC 3.0.0 I get error:

unit1.pas(30,42) Error: Default values can only be specified for
value, const and constref parameters

Had to change constref to const but why? Even error message is saying that constref is ok

Tested on:
Linux Xubuntu 14.04 32bit
Lazarus 1.6 from i386 deb package
FPC 3.0.0 from i386 dep package

Regards

Reply by email

Maciej Izak
to Krzysztof: This code worked fine on FPC 2.6.4: procedure Test(constref AParam: String = 'def_param');

2016-03-28 17:49 GMT+02:00 Krzysztof :

Show quoted text 12 lines
This code worked fine on FPC 2.6.4: procedure Test(constref AParam: String = 'def_param'); begin writeln(AParam); end; But on FPC 3.0.0 I get error: unit1.pas(30,42) Error: Default values can only be specified for value, const and constref parameters

I can confirm. Seems like is worth to put this on bugtracker :)

Best regards, Maciej Izak

Reply by email