Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  107731   Status: Closed
Type inference from open array arguments
Project:  Delphi Build #:  17.0.4625.53395
Version:    17.0 Submitted By:   Blaise Thorn
Report Type:  Basic functionality failure Date Reported:  8/7/2012 2:12:34 PM
Severity:    Commonly encountered problem Last Updated: 4/15/2014 6:47:11 PM
Platform:    All platforms Internal Tracking #:   30807
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: 40
Description
See also QC 107458 "Type inference from open array constructors".

Tags: E2010
Steps to Reproduce:
// Compile this program. Expected: success; Actual: three E2010 errors.
type Tester = record

procedure Foo<T>(const A: array of T);
end;

procedure Tester.Foo<T>(const A: array of T);
begin
end;

procedure Test(const OpenA: array of Integer);
var
T: Tester;

StaticA: array[0..1] of Integer;

DynamicA: array of Integer;
begin

T.Foo<Integer>( StaticA );
// works

T.Foo<Integer>( DynamicA );
// works

T.Foo<Integer>( OpenA );
// works


T.Foo( StaticA );

// ^- E2010 Incompatible types: 'array of T' and 'array[0..1] of Integer'

T.Foo( DynamicA );

// ^- E2010 Incompatible types: 'array of T' and 'Dynamic array'

T.Foo( OpenA );

// ^- E2010 Incompatible types: 'array of T' and 'array of Integer'
end;

begin

Test([42])
end.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01