Compiler 3.3.1 goes into Endless-loop - recursive specialization of generic within the generic itself

FPC 3.3.1 559fcdf7

The below code compiles forever.

program Project1;
{$mode objfpc}

type
  generic TFoo<T: class> = class(T)
    strict private type
      FFoo = class(specialize TFoo<TFoo>) end;
  end;


  TBar = specialize TFoo<TObject>;
begin
end.