Compare procedural pointers in XE6
The following sample program, compiled with Delphi XE2 and earlier:
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
{$TYPEDADDRESS ON}
type
TMyProc = procedure(Dummy: Integer);
procedure MyProcA(Dummy: Integer);
begin
//
end;
var
MyProcVar: TMyProc;
function Test: Boolean;
begin
Result := @MyProcVar = @MyProcA;
end;
begin
if Test then
Writeln('OK');
end.
It no longer compiles in XE6 with an error
[dcc32 Fehler] Project1.dpr (22): E2008 Inkompatible Typen
which translates to
[dcc32 error] Project1.dpr (22): E2008 Incompatible types
If I switch to {$TYPEDADDRESS OFF}
or Addr(MyProcVar) = Addr(MyProcA)
, it compiles. Is this a bug in XE6 or in XE2 that maybe shouldn't have compiled it?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: