On 27 May 2010, at 16:01, Yann Bat wrote:

> I don't understand why compilation of the program below failed in fpc
> and objfpc mode. In tp and delphi mode it works as expected but in fpc
> and objfpc mode the compiler complains :
> 
>  blob.pas(17,3) Error: Constants of objects containing a VMT aren't allowed
>  blob.pas(17,3) Fatal: Syntax error, ";" expected but "(" found
> 
> Since my object has no virtual methods why a VMT ?

The compiler always adds a VMT if an object has a constructor or destructor. 
The reason is that the VMT also contains the instance size, which is used by 
the constructor helper to allocate the required amount of memory.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to