View Issue Details

IDProjectCategoryView StatusLast Update
0031528FPCCompilerpublic2020-12-22 13:51
ReporterBenito van der Zander Assigned ToSven Barth  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version3.1.1 
Fixed in Version3.3.1 
Summary0031528: pointer to advanced record methods
DescriptionPointers to methods of advanced records should behave like pointers to class methods.
Currently they do not seem to be compatible to any procedure pointers.


Steps To ReproduceE.g.

type TTest = record
  procedure a;
end;
var r: TTest;
    a: procedure of object;
    p: procedure;
begin
  p := @r.a;
  a := @r.a;

 
Both assignments are rejected:


project1.lpr(24,8) Error: Incompatible types: got "PROJECT1.<procedure variable type of procedure;Register>" expected "PROJECT1.<procedure variable type of procedure;Register>"
project1.lpr(25,8) Error: Incompatible types: got "<procedure variable type of procedure;Register>" expected "<procedure variable type of procedure of object;Register>"


Yet you can do

  TMethod(a).Code := @r.a;
  TMethod(a).Data := @r;
TagsNo tags attached.
Fixed in Revision47826
FPCOldBugId
FPCTarget-
Attached Files

Relationships

duplicate of 0038238 closedSven Barth Pointers to record methods don't seem to work 

Activities

Sven Barth

2020-12-22 13:51

manager   ~0127761

The method variable should now work since r47826. Procedure variables are not allowed.

Please test and close if okay (and thank you for reminding me about this report ;) ).

Issue History

Date Modified Username Field Change
2017-03-13 00:47 Benito van der Zander New Issue
2020-12-22 13:51 Sven Barth Assigned To => Sven Barth
2020-12-22 13:51 Sven Barth Status new => resolved
2020-12-22 13:51 Sven Barth Resolution open => fixed
2020-12-22 13:51 Sven Barth Fixed in Version => 3.3.1
2020-12-22 13:51 Sven Barth Fixed in Revision => 47826
2020-12-22 13:51 Sven Barth FPCTarget => -
2020-12-22 13:51 Sven Barth Note Added: 0127761
2020-12-22 13:51 Sven Barth Relationship added duplicate of 0038238