Recent

Author Topic: generics  (Read 2466 times)

airpas

  • Full Member
  • ***
  • Posts: 179
generics
« on: January 30, 2015, 11:04:57 am »
hi
do we need specialization in {$mode delphi} too ?
this code works ok with delphi
Code: [Select]
{$mode delphi}
type
     gArray<T> = array of T;
     gData<T> = record
      private
        data : gArray<T>;
      public
      property mData: gArray<T> read data write data;   // Error: Generics without specialization cannot be used as a type for a variable
    end;


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: generics
« Reply #1 on: January 30, 2015, 11:28:49 am »
No, but the Delphi generics were started after the FPC generics, so they lag.

Please file a bug (but make sure this isn't already reported, there are quite some generics bugreports)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: generics
« Reply #2 on: January 30, 2015, 05:24:10 pm »
Compiles cleanly in 3.1.1, so no need to report

airpas

  • Full Member
  • ***
  • Posts: 179
Re: generics
« Reply #3 on: January 30, 2015, 06:56:08 pm »
yes it works in 3.1.1 , thanks .
fpc 3 should released ASAP

 

TinyPortal © 2005-2018