Compiler hangs trying to resolve interface with recursive definition
Original Reporter info from Mantis: Hixie
-
Reporter name: Ian Hickson
Original Reporter info from Mantis: Hixie
- Reporter name: Ian Hickson
Description:
The compiler hangs compiling the following rather bogus code:
// compiled with: fpc test.pas -dDEBUG -Co -Cr -CR -Ct -O- -g -gt -gl -gh -Sa -veiwnhb
{$MODE OBJFPC} { -*- text -*- }
{$INTERFACES CORBA}
program test;
type
IMyInterface = interface end;
TMyClass = class(IMyInterface)
function GetImpl(): TMyClass;
property MyInterface: TMyClass read GetImpl implements IMyInterface;
end;
function TMyClass.GetImpl(): TMyClass;
begin
Result := nil; // or try Result := Self;
end;
var
X: TMyClass;
I: IMyInterface;
begin
X := TMyClass.Create();
I := X; // compiling this line hangs
X.Free();
end.
Mantis conversion info:
- Mantis ID: 24617
- Build: 2.7.1 [2013/06/02] for x86_64
- Platform: x86_64
- Version: 2.7.1
- Monitored by: » Hixie (Ian Hickson)