Sign in Join

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

Mailing lists / fpc-devel / 2025-04

class of nested.class ?

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Martin Frb

"class of" can use qualified identifiers. It works with "unit.classname".

But it can't be used on a class nested in another container? (same if TFoo is advanced record)

Is that intentional?

program Project1;
type
   TFoo = class
   public type
     TBar = class end;
   end;
   TFooClass = class of Project1.TFoo;
   TBarClass = class of TFoo.TBar;  /// <<<<<<< ERROR
begin
end.

Reply by email

Sven Barth
to Martin Frb

Martin Frb via fpc-devel schrieb am Do.,
3. Apr. 2025, 21:35:

Show quoted text 21 lines
"class of" can use qualified identifiers. It works with "unit.classname". But it can't be used on a class nested in another container? (same if TFoo is advanced record) Is that intentional? program Project1; type TFoo = class public type TBar = class end; end; TFooClass = class of Project1.TFoo; TBarClass = class of TFoo.TBar; /// <<<<<<< ERROR begin end.

Parsing unit names is different from parsing type names. Please report a bug.

Regards,
Sven

Reply by email