[fpc-devel]FYI: array constructor & string

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Nov 26 15:30:54 CET 2003


On Wed, 26 Nov 2003, Peter Vreman wrote:

> > Hi,
> >
> > I couldn't compile anything with the following:
> >
> > procedure x(const a:array of const);
> > var s:string; // ansistring or shortstring doesn't matter
> > x([s]);
> >
> > and tracked it down to the second change block of:
> > http://www.freepascal.org/cgi-bin/viewcvs.cgi/fpc/compiler/nld.pas.diff?r1=1.116&r2=1.117
> >
> > I put in
> >   stringdef :
> >      hp.left:=ctypeconvnode.create(hp.left,cansistringtype);
> >
> > I doubt that this is the correct fix, it does however (properly?)
> > compile above example after this change (with both shortstring and
> > ansistring).
>
> The correct fix is even smaller:
>
> --- nld.pas.bak Mon Nov 24 02:02:20 2003
> +++ nld.pas     Wed Nov 26 15:11:16 2003
> @@ -1027,6 +1027,7 @@
>                       hp.left:=ctypeconvnode.create(hp.left,pbestrealtype^);
>                     procvardef :
>                       hp.left:=ctypeconvnode.create(hp.left,voidpointertype);
> +                   stringdef,
>                     variantdef,
>                     pointerdef,
>                     classrefdef,

Applied.

Michael.




More information about the fpc-devel mailing list