View Issue Details

IDProjectCategoryView StatusLast Update
0035149FPCCompilerpublic2019-02-25 22:17
ReporterJulian PuhlAssigned ToJonas Maebe 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformwin32OSOS Version
Product Version3.3.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0035149: Revision 40785 breaks sizeof call for nested vars
DescriptionIf you compile the given example you'll get the (wrong) error message:
"project1.lpr(11,39) Error: Only static methods and static variables can be referenced through an object type".

I've also gotten this error for using nested types in some cases, but could not create a small example that breaks, yet.
Steps To Reproduceprogram project1;

{$mode objfpc}
type
  TestObject = object
  var
    TestNested: Integer;
  end;

begin
  writeln(SizeOf(TestObject.TestNested));
end.
TagsNo tags attached.
Fixed in Revision41474
FPCOldBugId
FPCTarget
Attached Files

Activities

Anton Kavalenka

2019-02-25 20:43

reporter   ~0114425

IMO class vars have to be in class or advanced record entity.

Old TP-style objects cannot hold class-vars.

Jonas Maebe

2019-02-25 21:29

manager   ~0114428

FPC supports the "static" keyword to declare class variables in TP-style objects.

Julian Puhl

2019-02-25 21:35

reporter   ~0114429

It works with records, so why wouldn't it with objects?

Jonas Maebe

2019-02-25 22:17

manager   ~0114432

Thanks, fixed.

Issue History

Date Modified Username Field Change
2019-02-25 17:50 Julian Puhl New Issue
2019-02-25 20:43 Anton Kavalenka Note Added: 0114425
2019-02-25 21:29 Jonas Maebe Note Added: 0114428
2019-02-25 21:35 Julian Puhl Note Added: 0114429
2019-02-25 22:17 Jonas Maebe Fixed in Revision => 41474
2019-02-25 22:17 Jonas Maebe Note Added: 0114432
2019-02-25 22:17 Jonas Maebe Status new => resolved
2019-02-25 22:17 Jonas Maebe Fixed in Version => 3.3.1
2019-02-25 22:17 Jonas Maebe Resolution open => fixed
2019-02-25 22:17 Jonas Maebe Assigned To => Jonas Maebe