Sign in Join

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

Mailing lists / fpc-pascal / 2013-01

Generic + nested type = forward declaration not solved

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

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.
Sven Barth
to robin
robin wrote 17 lines
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