Sign in Join

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

Mailing lists / fpc-pascal / 2018-06

:= overload with implicit arrays in generics

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

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

Ryan Joseph

Is this is a bug or am I not doing something right? I wanted to assign an implicit array (I think thats what those parameters are being called now) so I made an overload but the compiler is complaining. Using single characters gives a different error because the compiler thinks it’s an array of char instead of array of string.

type
	generic TMyCollection<T> = record
	 class operator := (values: array of T): TMyCollection;
	end;
class operator TMyCollection.:= (values: array of T): TMyCollection;
begin
end;
var
	c: specialize TMyCollection<string>;
begin
	c := ['aaa', 'bbb', 'ccc’]; // Ordinal expression expected

Regards,
Ryan Joseph

Reply by email

Ryan Joseph
to Ryan Joseph

Did anyone have any idea about this or should I just file a bug report for now? I don’t want to forget about it if possible.

Show quoted text 15 lines
On Jun 2, 2018, at 1:05 PM, Ryan Joseph wrote: type generic TMyCollection<T> = record class operator := (values: array of T): TMyCollection; end; class operator TMyCollection.:= (values: array of T): TMyCollection; begin end; var c: specialize TMyCollection<string>; begin c := ['aaa', 'bbb', 'ccc’]; // Ordinal expression expected

Regards,
Ryan Joseph

Reply by email