Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  104493   Status: Closed
[REGRESSION] Error if class' array property uses getters/setters of ancestor generic class
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Basil Peace
Report Type:  Crash / Data loss / Total failure Date Reported:  3/28/2012 10:28:25 PM
Severity:    Commonly encountered problem Last Updated: 9/5/2012 7:55:50 PM
Platform:    All platforms Internal Tracking #:   26929
Resolution: Fixed (Resolution Comments) Resolved in Build: : 17.0.4625.53395
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Generic class has (protected) getter and setter for array property.
The property itself is declared in descendant instantiated class and uses methods of base generic class.
While instantiation of this class we get error:
In IDE:
[DCC Fatal Error] Unit1.pas(18): F2084 Internal Error: D21196

In command line:
Unit1.pas(1) failed to find getter: TReadOnlyGeneric`2.GetItem s002CC580 for TReadWriteSample.Items
Unit1.pas(18) Fatal: F2084 Internal Error: D21018

This problem is applied only to array properties.

{ USc: This is regression from XE that I do see already with the first XE2 compiler and this issue seems to be related to RAID #283759 and RAID #282054. }
Steps to Reproduce:
Steps by USc with test case by the reporter turned into a program:
- save to following program
- dcc32/dcc64/dccosx QC104493.dpr

expected: it compiles
actual:
QC104493.dpr(1) failed to find getter: TReadOnlyGeneric`2.GetItem s002EC6C0 for TReadWriteSample.Items
QC104493.dpr(18) Fatal: F2084 Internal Error: D21196

program QC104493;

{$APPTYPE CONSOLE}

type  
  TReadOnlyGeneric<T1, T2> = class
  protected
    function GetItem(const AIndex: T1): T2;
    procedure SetItem(const AIndex: T1; const AValue: T2);
{ real usage - overriding property:
  public
    property Items[const AIndex: T1]: T2 read GetItem;}
  end;
  
  TReadWriteSample = class(TReadOnlyGeneric<String, Integer>)
  public
    property Items[const AIndex: String]: Integer read GetItem write SetItem;
  end;

function TReadOnlyGeneric<T1, T2>.GetItem(const AIndex: T1): T2;
begin
end;

procedure TReadOnlyGeneric<T1, T2>.SetItem(const AIndex: T1; const AValue: T2);
begin
end;

begin
  WriteLn('PASS'); // on compile
end.
Workarounds
If mark GetItem & SetItem as virtuals, all is OK.
Attachment
None
Comments

Tomohiro Takahashi at 4/3/2012 7:20:49 PM -
This report was opened with valid Internal Tracking Number.
Thanks.

Server Response from: ETNACODE01