www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bug? array concatenation/appand

reply icee <iceelyne gmail.com> writes:
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.
Jun 26 2006
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"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.
Jun 26 2006
prev sibling parent Rémy Mouëza <ray.jay.ay.moueza DoNtSpAm.gmail.com> writes:
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 ?
Jun 27 2006