Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Generics    [ Add a report in this area ]  
Report #:  108179   Status: Closed
$TypedAddress and generic pointers
Project:  Delphi Build #:  17.0.4625.53395
Version:    17.0 Submitted By:   Blaise Thorn
Report Type:  Basic functionality failure Date Reported:  8/23/2012 9:16:37 AM
Severity:    Commonly encountered problem Last Updated: 4/15/2014 6:46:51 PM
Platform:    All platforms Internal Tracking #:   31407
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
In the provided test case, the compiler does not consider the variable X and the field F.Y to be of structurally equivalent types.
The same scenario works with non-generic typed pointers.

Tags: E2010
Steps to Reproduce:
// Expected: this program gets compiled; Actual: bogus E2010
program Z;
{$TypedAddress on}

type A<T> = class

type PT = ^T;

var Y: PT;
end;

type L<T> = record end;

type G<T> = class

var F: A<L<T>>;

procedure Test;
end;

procedure G<T>.Test;
var
X: ^L<T>;
begin

X := F.Y;
// compatible

F.Y := X;
// compatible

if X = F.Y then

// ^- BOGUS E2010:

//  Incompatible types: 'Pointer' and 'Z.A<Z.L<Z.G<T>.T>>.PT'
end;

end.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01