Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  106602   Status: Closed
REGRESSION: Unexpected E2009 Incompatible types: 'Parameter lists differ'
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Jason Sprenger
Report Type:  Basic functionality failure Date Reported:  6/21/2012 2:01:59 PM
Severity:    Serious / Highly visible problem Last Updated: 9/5/2012 7:47:57 PM
Platform:    All platforms Internal Tracking #:   29217
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
Source code involving generics that compiles with Delphi XE2 (16.0.4358.45540).

No longer compiles with Update 4.


(Found by Jim Ferguson)
Steps to Reproduce:
Compile the following attached test cases with Delphi XE2 Update 4.

See following unexpected compile-time error.

Error: E2009 Incompatible types: 'Parameter lists differ'

{Narrowed down by Blaise Thorn}
program Test;

type
  G<T> = class
  type
  TItem = record
    A, B: Pointer;
    // ^-- make sure our instances will be passed by reference
    class procedure Foo(const V: TItem); static;
  end;

  procedure Failure;
end;

class procedure G<T>.TItem.Foo(const V: TItem); begin end;

procedure G<T>.Failure;
var F: procedure(const V: TItem);
begin
  F := TItem.Foo
  // ^-- BOGUS: E2009 Incompatible types: 'Parameter lists differ'
end;

begin
  WriteLn('PASS'); //PASS on compile //
end.


{Narrowed down by Uwe Schuster}
unit Unit37;

interface

type
  TArray<T> = record
  public
    type
      TCompareProc = function(const Value1, Value2: T): Integer;//#1

    procedure Sort_<K>(Compare: TCompareProc);
  end;

  TRead = function: Boolean of object;//#2

  TSettingsAsText<T> = record
  public
    type
      TItem = record
        FRead: TRead;//#3
        class function Compare(const Item1,Item2: TItem): Integer;
          static;//#1
      end;
    class var _Fields: TArray<TItem>;
    class constructor Create;
  end;

implementation

class function TSettingsAsText<T>.TItem.Compare(const Item1,
  Item2: TItem): Integer;//#1
begin
end;

class constructor TSettingsAsText<T>.Create;
begin
  _Fields.Sort_<pChar>(TItem.Compare);
end;

procedure TArray<T>.Sort_<K>(Compare: TCompareProc);
begin

end;

end.



Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 6/25/2012 6:28:04 AM -
This report was opened with valid Internal Tracking Number.
Thanks.

Server Response from: ETNACODE01