Sign in Join

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

Mailing lists / fpc-pascal / 2014-02

Nested generic parameters

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Constantine Yannakopoulos

Hello again,

Can I use a defined generic type parameter inside a constraint of the same generic declaration on FPC trunk code? Something like:

{$mode Delphi}
type
  TFoo<T> = class
  end;
  TGeneric<T, U: TFoo<T>> = class
  end;

This compiles in Delphi XE or later but in FPC it gives the error "Identifier not found 'T'" at the T parameter in the constraint.

Thanks in advance.

--Constantine

Sven Barth
to Constantine Yannakopoulos
Constantine Yannakopoulos wrote 20 lines
Hello again, Can I use a defined generic type parameter inside a constraint of the same generic declaration on FPC trunk code? Something like: {$mode Delphi} type TFoo<T> = class end; TGeneric<T, U: TFoo<T>> = class end; This compiles in Delphi XE or later but in FPC it gives the error "Identifier not found 'T'" at the T parameter in the constraint. Thanks in advance.

Yes, that is not supported yet. Please report as a bug, so that it is not forgotten (and attach a simple example that compiles in Delphi).

Regards,
Sven