View Issue Details

IDProjectCategoryView StatusLast Update
0036397FPCCompilerpublic2019-12-05 21:47
Reporterd.v.k@mail.ruAssigned ToFlorian 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformOSWindowsOS Version10
Product Version3.0.4Product Build 
Target VersionFixed in Version3.3.1 
Summary0036397: "Internal error 200301042" when try to assign class method of object to a simple procedural variable
DescriptionI came across this problem when I tried to modify an example from the documentation (Free Pascal Reference guide. CHAPTER 5. OBJECTS. Class or static methods).
If I try to assign a regular procedural variable e.g. "P: procedure;" address of the class method of the object, the compiler returns "Internal error 200301042" instead of a message about the signature mismatch. A minimal example is attached to this post.
(By the way, returning to an example from the documentation, after analyzing this example, I came to the conclusion that it needs to be rewritten, in its current form it does more harm than good (I mean the practice of assigning P: = @SomeProcedure (emphasis on operations " @ "))
Steps To ReproduceCompile an attached project
TagsNo tags attached.
Fixed in Revision43650
FPCOldBugId
FPCTarget-
Attached Files
  • Project1.pas (213 bytes)
    program Project1;
    
    {$mode delphi}
    
    type
      TTest = object
        class procedure myproc;
      end;
    
      class procedure TTest.myproc;
      begin
      end;
    
    var
      p: procedure;
    begin
      p := TTest.myproc;
    end.
    
    
    Project1.pas (213 bytes)

Activities

d.v.k@mail.ru

2019-12-04 12:28

reporter  

Project1.pas (213 bytes)
program Project1;

{$mode delphi}

type
  TTest = object
    class procedure myproc;
  end;

  class procedure TTest.myproc;
  begin
  end;

var
  p: procedure;
begin
  p := TTest.myproc;
end.

Project1.pas (213 bytes)

Florian

2019-12-05 21:47

administrator   ~0119644

Regarding the documentation examples: in FPC mode, the @ is required to make it easier for the compiler to detect that actually no function call is meant.

Issue History

Date Modified Username Field Change
2019-12-04 12:28 d.v.k@mail.ru New Issue
2019-12-04 12:28 d.v.k@mail.ru File Added: Project1.pas
2019-12-05 21:47 Florian Assigned To => Florian
2019-12-05 21:47 Florian Status new => resolved
2019-12-05 21:47 Florian Resolution open => fixed
2019-12-05 21:47 Florian Fixed in Version => 3.3.1
2019-12-05 21:47 Florian Fixed in Revision => 43650
2019-12-05 21:47 Florian FPCTarget => -
2019-12-05 21:47 Florian Note Added: 0119644