rgdawson 8 Posted Friday at 03:14 PM (edited) FYI, I ran into this interesting case in one of my apps so I created simple example to reproduce. The example uses a combination of a Custom Managed Record, a class function that returns the CMR type, and inline variables with a variable assigned to an anonymous function inline, and where the anonymous function captures the CMR variable. In my simple example, compilation fails with "F2084 Internal Error C25335". It will compile fine if the function is defined as a nested function, instead of inline/anonymous. In my application, I have also seen this case compile, however the CMR initialization/finalization does not occur correctly. So, here is another case where Custom Managed Records have bugs. Here is the code: program CmrTest; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; type TMyRecord = record private FValue: Integer; public class operator Initialize (out Dest: TMyRecord); class function New(Value: integer): TMyRecord; static; property Value: integer read FValue write FValue; end; class operator TMyRecord.Initialize(out Dest: TMyRecord); begin Dest.FValue := 10; end; class function TMyRecord.New(Value: integer): TMyRecord; begin Result.Value := Value; end; {$DEFINE ERRORCASE} {$IFDEF ERRORCASE} procedure TestCase; {!! Compile fails with "F2084 Internal Error C25335"} begin var MyRecord := TMyRecord.New(20); var DivBy10 := function: integer begin Result := MyRecord.Value div 10; end; end; {$ELSE} procedure TestCase; {Compiles OK} var MyRecord: TMyRecord; function DivBy10: Integer; begin Result := MyRecord.Value div 10; end; begin MyRecord := TMyRecord.New(20); end; {$ENDIF} begin try TestCase; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. Edited Friday at 04:14 PM by rgdawson Share this post Link to post
Stefan Glienke 2030 Posted Friday at 04:05 PM Without saying too much there is the possibility that this issue (https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2458) will be fixed in the next release. Share this post Link to post
rgdawson 8 Posted Friday at 04:18 PM Thanks, that's interesting. That explains why I saw different behavior in my app. The example was 32-bit, where compile fails. In 64-bit it does compile, but actually still does not work correctly. Good to know Embarcadero is on it. Share this post Link to post