Sign in Join

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

Mailing lists / fpc-pascal / 2020-01

Delphi generics bug?

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Ryan Joseph

Is this a bug or intended behavior? I would think there should a type mismatch.

{$mode delphi}
program test;
type
  TFooA = class
  end;
type
  TFooB = class
  end;
type
  TList<T: TFooA> = class
    procedure Foo;
  end;
procedure TList<T: TFooB>.Foo;
begin
end;
begin
end.

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph via fpc-pascal schrieb am
Di., 14. Jan. 2020, 11:26:

Show quoted text 26 lines
Is this a bug or intended behavior? I would think there should a type mismatch. {$mode delphi} program test; type TFooA = class end; type TFooB = class end; type TList<T: TFooA> = class procedure Foo; end; procedure TList<T: TFooB>.Foo; begin end; begin end.

It's a bug because constraints should not be allowed in definitions, only in declarations.

Regards,
Sven

Reply by email

Ryan Joseph
to Sven Barth
On Jan 14, 2020, at 8:04 PM, Sven Barth via fpc-pascal wrote: It's a bug because constraints should not be allowed in definitions, only in declarations.

ok, I'll file a report if you want me to. I'll just leave it as it is for the constants because the fix will probably encompass both of them.

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph via fpc-pascal schrieb am
Di., 14. Jan. 2020, 14:31:

Show quoted text 12 lines
> On Jan 14, 2020, at 8:04 PM, Sven Barth via fpc-pascal < > wrote: > > It's a bug because constraints should not be allowed in definitions, only in declarations. > ok, I'll file a report if you want me to. I'll just leave it as it is for the constants because the fix will probably encompass both of them.

Indeed. And yes, please file a bug.

Regards,
Sven

Reply by email