Delphi 编译此函数时没有响应?

Delphi 编译此函数时没有响应?,delphi,compilation,delphi-xe,Delphi,Compilation,Delphi Xe,我尝试使用Delphi XE,但编译时没有响应。它是否在你的电脑中工作,或者功能是否有问题 function Test(const FileName: string; const Force: boolean = false): boolean; var IsAllowed: boolean; begin result := false; if FileExists(FileName) then begin try if (Force) then

我尝试使用Delphi XE,但编译时没有响应。它是否在你的电脑中工作,或者功能是否有问题

function Test(const FileName: string;
  const Force: boolean = false): boolean;
var
  IsAllowed: boolean;
begin
  result := false;
  if FileExists(FileName) then
  begin
    try
      if (Force) then
      begin
        result := false;
        exit;
      end;
    finally
      if IsAllowed then
        DeleteFile(FileName);
    end;

    try
      result := true;
    except
      result := false;
    end;
  end;
end;

它在我的电脑上编译。虽然我得到警告W1036变量“IsAllowed”可能尚未初始化

更新:当我在uses子句中包含窗口时,我可以复制挂起。 提交至质量中心:。

program hang_test;

{$APPTYPE CONSOLE}

uses
  // Windows, // uncomment to include Windows -> hang on compile
  SysUtils;

function Test(const FileName: string; const Force: boolean = false): boolean;
  // your function here

begin
  try

  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
它看起来像一只虫子;你应该在报告中报告

更新2:重复挂起编译器的最小情况:

function HangCompiler: Boolean;
begin
  try
    Exit; // 1. exit from a try..finally
  finally
    DeleteFile(''); // 2. inlined function call in finally (include Windows to inline)
  end;
  // 3. try..except
  try
    Result := True;
  except
    Result := False;
  end;
end;

该函数在我的Delphi2010中编译得很好。是的,我认为它可能也没有初始化过!如果我注释掉
DeleteFile(文件名),我可以编译它
结果:=真。Delphi XE的版本是什么?是的,uses子句中的Windows是麻烦制造者。我只是试着注释掉
Windows
,我就可以编译这个函数了。Delphi XE 15.0.3953.3571,更新1和帮助更新2。顺便说一句,命令行编译器也挂起。您可以通过声明自己的DeleteFile版本来解决这个问题,该版本不是内联的?