Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  120210   Status: Closed
Internal Compiler Error in generic class method in record
Project:  Delphi Build #:  XE3, ... XE5
Version:    19.0 Submitted By:   Asbjørn Heid
Report Type:  Crash / Data loss / Total failure Date Reported:  11/3/2013 1:29:31 PM
Severity:    Infrequently encountered problem Last Updated: 4/15/2014 6:37:20 PM
Platform:    All versions Internal Tracking #:   44682
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
Compiling the program listed in steps results in the following internal compiler error:

F2084 Internal Error: AV089BAC7F-R00000001-0

This only occurs if TRec is declared as a record. If the declaration is change to
  TRec = class
then the code compiles as expected.

Steps to Reproduce:
--------
program Project1;

type
  Value<T> = class
  public
    class function Get: T; virtual; abstract;
  end;

  IntegerValue = class(Value<integer>)
  public
    class function Get: integer; override;
  end;

class function IntegerValue.Get: integer;
begin
  result := 42;
end;

type
  TRec = record
  public
    class function Foo<T; V: Value<T>>(): T; static;
  end;

class function TRec.Foo<T, V>(): T;
type
  Func = function(): T of object;
var
  f: Func;
begin
  f := V.Get;
  result := f();
end; // error here

begin
  TRec.Foo<integer, IntegerValue>();
end.
--------
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01