Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-12

Helper type and class fields

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hello,

From the Embarcadero wiki:

"A helper type may not declare instance data, but class fields are allowed." (
http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi) ).

In Delphi it compiles fine:

  TFoo = class
  end;
  TBar = class helper for TFoo
  private class var
    FFoo: TFoo;
  end;

In FPC:

project1.lpr(11,5) Error: An interface, helper or Objective-C protocol or
category cannot contain fields

Bug?

Thank you!

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

Sven Barth
to silvioprog
"silvioprog" wrote 6 lines
Hello, From the Embarcadero wiki: "A helper type may not declare instance data, but class fields are

allowed." (
http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi) ).

Show quoted text 14 lines
In Delphi it compiles fine: TFoo = class end; TBar = class helper for TFoo private class var FFoo: TFoo; end; In FPC: project1.lpr(11,5) Error: An interface, helper or Objective-C protocol or

category cannot contain fields

Bug?

Yes, bug. Please report.

Regards,
Sven

Reply by email

silvioprog
to Sven Barth
Sven Barth wrote 33 lines
Am 01.12.2014 18:59 schrieb "silvioprog" : > > Hello, > > From the Embarcadero wiki: > > "A helper type may not declare instance data, but class fields are allowed." ( http://docwiki.embarcadero.com/RADStudio/XE7/en/Class_and_Record_Helpers_(Delphi) ). > > In Delphi it compiles fine: > > TFoo = class > end; > > TBar = class helper for TFoo > private class var > FFoo: TFoo; > end; > > In FPC: > > project1.lpr(11,5) Error: An interface, helper or Objective-C protocol or category cannot contain fields > > Bug? Yes, bug. Please report. Regards, Sven

Done: http://bugs.freepascal.org/view.php?id=27120.

Thx!

Silvio Clécio My public projects - github.com/silvioprog

Reply by email