It compiles on my computer. Although I get warning W1036, the variable "IsAllowed" may not have been initialized.
Update: I can reproduce the hang when I include Windows in the uses clause. Submitted to Quality Central: QC93806 .
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.
Sounds like a mistake; You must report this to Quality Central .
Update 2: the minimum register that the compiler reproduces:
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;
source share