[fpc-pascal] Typecast class-of to class

Jonas Maebe jonas at freepascal.org
Sun Feb 19 09:05:55 CET 2017



Mattias Gaertner wrote:
> FPC allows to type cast a class-of variable to a class instance. Is
> this a bug or a feature?
> 
> var
>   c: TClass;
> begin
>   TObject(c).ClassName; // crash
> end.

With -CR you should get an object check error instead.


Jonas



More information about the fpc-pascal mailing list