[fpc-devel] enums and integer auto conversion

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Sep 10 22:42:25 CEST 2012


On 10 Sep 2012, at 20:03, Den Jean wrote:

> As described in 
> http://bugs.freepascal.org/view.php?id=22797
> 
> fpc 2.7.1 does not allow anymore to pass an enum
> to a function expecting integers.

This has never been allowed. The only thing that was allowed was defining an enum as a default value for integer parameters. But then again, you could also define a char, a floating point value, a string, or really anything as default value for any kind of parameter. The compiler was simply missing any kind of type checking for the default value.

> Note that there has always been a
> {$MINENUMSIZE 4} in qt4.pas

That defines the size, not the type.

> Is this intended behaviour ? I really hope it is not.

It is.

> I cannot define the type of the parameter
> as the enumtype because the expected values
> are either the enum or combinations of the enum (or)

As mentioned above, that never worked in the past either.


Jonas


More information about the fpc-devel mailing list