Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  107724   Status: Closed
Single type inference from multiple 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 9:54:23 AM
Severity:    Commonly encountered problem Last Updated: 4/15/2014 6:47:13 PM
Platform:    All platforms Internal Tracking #:   30780
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
The compiler erroneously reports "Couldn't infer generic type argument from different argument types for method '%s'" for the test program.

Tags: E2532
Steps to Reproduce:
// Compile this program. Expected: success; Actual: two bogus E2532.
type Test = record

procedure Foo<T>(const X, Y: T);

procedure Bar<T>(const A: array of T);  OVERLOAD{see QC 107458};
end;

procedure Test.Foo<T>(const X, Y: T); begin end;
procedure Test.Bar<T>(const A: array of T); begin end;

var
T: Test;

X, Y: Integer;
begin

T.Foo( X, Y );
// works

T.Foo( X, Y+42 );
// E2532

T.Foo( X, Integer(Y+42) );
// works

T.Foo( X-7, Y+42 );
// NB: works


T.Bar( [X, Y] );
// works

T.Bar( [X+7, Y] );
// E2532

T.Bar( [Integer(X+7), Y] );
// works

T.Bar( [X-42, Y+7] );
// NB: works
end.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01