Delphi 2007: reproduction and workaround for “[DCC Error] ….pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0”
Posted by jpluimers on 2012/07/31
Just in case you come across this error ([WayBack] QC 108189):
[DCC Error] CompilerAVUnit.pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0
I had this error in a really complicated unit that I tried to backport from Delphi XE2 to Delphi 2007 (as there was some non-unicode compliant app that needed this).
I could not find it searching for F2084 Internal Error, so I sat down and trimmed it down to the CompilerAVUnit below.
The workaround is simple: remove the static;
from method Outer
and it compiles fine.
I will post more details on the static keyword in Delphi in a future blog post. For now I’ll keep it at this:
The reason I needed the static is that I had a class property, and the method Outer was in fact a function.
That is easy to workaround too have the property use a static getter which calls the non-static Outer.
type TMethod = function: Integer of object; TmsxmlFactory = class(TObject) class function Outer: Integer; // static; // remove "static;" and the AV goes away class function ClassMethod: Integer; class procedure CallClassMethod(const Method: TMethod); class function GetValue: Integer; static; class property Value: Integer read Outer; end; class function TmsxmlFactory.GetValue: Integer; // non static begin Result := Outer; end;
–jeroen
unit CompilerAVUnit; { Reproduction for: [DCC Error] CompilerAVUnit.pas(26): F2084 Internal Error: AV21BCE0AC-R00000000-0 } interface type TMethod = procedure of object; TmsxmlFactory = class(TObject) class procedure Outer; static; // remove "static;" and the AV goes away class procedure ClassMethod; class procedure CallClassMethod(const Method: TMethod); end; implementation class procedure TmsxmlFactory.Outer; var Value: TMethod; begin Value := ClassMethod; CallClassMethod(Value); end; class procedure TmsxmlFactory.ClassMethod; begin end; class procedure TmsxmlFactory.CallClassMethod(const Method: TMethod); begin end; end.
QualityCoding.info said
Cool, I found your blog. You’re the guy who gave a presentation at CodeRage and your accent makes you sound like the guy in the movie Gold Member. I really enjoyed your presentation. Thx.
jpluimers said
You are most welcome (:
Which of the guys from Gold Member do I sound like? Austin Powers? If so, that’d be a blast!
–jeroen
Evgeny said
Delete all .dcu files. I had the same problem when migrated the project from XE to XE2.
jpluimers said
That didn’t work; it reproduces even without .dcu files, and with a fresh Delphi start.
Uwe Schuster said
I couldn’t find an existing report for the issue. Even if the issue is already fixed since D2009 please file a QC report for it to make sure Embarcadero has a test for it in their test suite.
jpluimers said
Done: http://qc.embarcadero.com/wc/qcmain.aspx?d=108189
Uwe Schuster said
I’ll check later if this is a known issue.
jpluimers said
I couldn’t find it in QC. Let me know if you can’t either and I’ll add it.