Generic + nested type = forward declaration not solved

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Generic + nested type = forward declaration not solved

robin
Why does the following fail with:
 test.pp(7,29) Error: Forward declaration not solved "constructor
TVector$LongInt.TIter.Create;"

program Test;
{$mode objfpc}{$H+}
type
    generic TVector<T> = object
        type
            TIter = object
                constructor Create;
            end;
    end;
    TIntVector = specialize TVector<Integer>;
constructor TVector.TIter.Create; begin end;
begin
end.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Generic + nested type = forward declaration not solved

Sven Barth-2
Am 16.01.2013 04:09, schrieb robin:

> Why does the following fail with:
>   test.pp(7,29) Error: Forward declaration not solved "constructor
> TVector$LongInt.TIter.Create;"
>
> program Test;
> {$mode objfpc}{$H+}
> type
>      generic TVector<T> = object
>          type
>              TIter = object
>                  constructor Create;
>              end;
>      end;
>      TIntVector = specialize TVector<Integer>;
> constructor TVector.TIter.Create; begin end;
> begin
> end.
An important information is missing: which compiler version do you use?
There were many improvements regarding generics in 2.7.1 that won't be
backmerged to 2.6.x.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Generic + nested type = forward declaration not solved

leledumbo
Administrator
Indeed updating FPC is your solution, it compiles in my 2.7.1 revision