Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  104663   Status: Closed
Generic type with Key/Value type in local procedure scope fails to compile
Project:  Delphi Build #:  14.0.3593.25826
Version:    14.0 Submitted By:   Zigmund Bulinsh
Report Type:  Crash / Data loss / Total failure Date Reported:  4/5/2012 7:01:12 AM
Severity:    Commonly encountered problem Last Updated: 4/6/2012 5:31:45 AM
Platform:    All versions Internal Tracking #:  
Resolution: Duplicate (Resolution Comments) Resolved in Build: : XE, XE2
Duplicate of:  81532
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Generic type with Key/Value type in local procedure scope fails to compile.

[DCC Fatal Error] Project26.dpr(31): F2084 Internal Error: AV21F8B1EB-R00000000-0
Steps to Reproduce:
program Project26;

uses
  Classes, Generics.Defaults, Generics.Collections;

type
  TClass = class
    procedure Proc;
  end;

procedure TClass.Proc;
type
  TKey = record
    A: String;
  end;
var
  Map: TDictionary<TKey, TClass>;
begin
end;

begin
end.
Workarounds
Workaround is to move the type to outer scope.

program Project26;

uses
  Classes, Generics.Defaults, Generics.Collections;

type
  TClass = class
    procedure Proc;
  end;

type
  TKey = record
    A: String;
  end;

procedure TClass.Proc;
var
  Map: TDictionary<TKey, TClass>;
begin
end;

begin
end.
Attachment
None
Comments

Zigmund Bulinsh at 4/5/2012 7:01:37 AM -
[DCC Fatal Error] Project26.dpr(31): F2084 Internal Error: AV21F8B1EB-R00000000-0

Tomohiro Takahashi at 4/5/2012 7:55:27 PM -
I compiled your code with Delphi XE Update 1 and Delphi XE2 Update 4.
But, I get no compile error.

Uwe Schuster at 4/6/2012 5:36:03 AM -
It repeats with D2010 Update 4/5 compiler, but not with XE or XE2. It generates the same AV as the test case in the following QC report when defining there TXRec as a record.

Report No: 81532 (RAID: 274692)          Status: Closed
Internal error: generic container for localy defined type
http://qc.embarcadero.com/wc/qcmain.aspx?d=81532

-> marked as duplicate

Server Response from: ETNACODE01