Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Anonymous Methods    [ Add a report in this area ]  
Report #:  68988   Status: Closed
Internal error with anonymous procedure accessing Result
Project:  Delphi Build #:  17555
Version:    12.0 Submitted By:   Andrei Chesaru
Report Type:  Crash / Data loss / Total failure Date Reported:  11/16/2008 9:40:01 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   266724
Resolution: Duplicate (Resolution Comments) Resolved in Build: : 12.0.3266.18473
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The compiler gives "F2084 Internal Error: T2675" for the code below, where an anonymous procedure that (if called) would set the Result of the function it is declared in. The cursor goes to the final end. The error T2675 is not documented.

type
  TProcReference = reference to procedure;

function MyFunc(): Boolean;
var
  LProc: TProcReference;
begin
  LProc := procedure()
  begin
    Result := True;
  end;

  LProc(); // would typically be something like: ExternalExecute(LProc);
end;

It should either work, give a more specific error message, with the cursor should be placed in the correct location (i.e. where "Result" is referenced), or the error should be documented.
Steps to Reproduce:
None
Workarounds
Use a local var:

function MyFunc(): Boolean;
var
  LProc: TProcReference;
  LResult: Boolean;
begin
  LProc := procedure()
  begin
    LResult := True;
  end;

  LProc(); // would typically be something like: ExternalExecute(LProc);
  Result := LResult;
end;
Attachment
None
Comments

None

Server Response from: ETNACODE01