Thread overview
Bug? array concatenation/appand
Jun 27, 2006
icee
Jun 27, 2006
Rémy Mouëza
June 27, 2006
struct SPoint{
double x,y;
SPoint create(double x,double y){
SPoint p;
p.x=x;
p.y=y;
return p;
}
}
..
SPoint[] sps;
sps~=SPoint.create(2,4);//OK.

sps=sps~SPoint.create(2,4);//Internal error: ..\ztc\type.c 308, dmd v0.161

int[] a;
a~=2;//OK.
a=a~2;//OK.

Is this a bug or I'd made some mistakes.


June 27, 2006
"icee" <iceelyne@gmail.com> wrote in message news:e7q4o7$7sk$1@digitaldaemon.com...

> Is this a bug or I'd made some mistakes.

All internal errors are bugs.


June 27, 2006
In article <e7q4o7$7sk$1@digitaldaemon.com>, icee says...
>
>struct SPoint{
>double x,y;
>SPoint create(double x,double y){
>SPoint p;
>p.x=x;
>p.y=y;
>return p;
>}
>}
>..
>SPoint[] sps;
>sps~=SPoint.create(2,4);//OK.
>
>sps=sps~SPoint.create(2,4);//Internal error: ..\ztc\type.c 308, dmd v0.161
>
>int[] a;
>a~=2;//OK.
>a=a~2;//OK.
>
>Is this a bug or I'd made some mistakes.
>

It seems that you are calling a non static function in a static context. The compiler should have detected this. Have you tried to put a static qualifier to the Spoint.create member function ?