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.



June 27, 2006
icee wrote:
> 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.
> 

I'll post the bug.

Just to help narrow the problem down, this works:

import std.stdio;

struct SPoint
{
  double x,y;
  static SPoint create(double x,double y)
  {
    SPoint p;
    p.x = x;
    p.y = y;
    return p;
  }
}

void main()
{
  SPoint[] sps;
  sps ~= SPoint.create(1,2);

//sps = sps ~ SPoint.create(2,4);  //Internal error: ..\ztc\type.c 308
  SPoint sp = SPoint.create(2,4);  //This works
  sps = sps ~ sp;

  int[] a;
  a ~= 2;
  a = a ~ 2;

  foreach(p; sps)
    writefln(p.x,",",p.y);
}