[Issue 227] New: Internal Compiler error: array concatenation/append on struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 26 21:09:23 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=227

           Summary: Internal Compiler error: array concatenation/append on
                    struct
           Product: D
           Version: 0.161
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: godaves at yahoo.com


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.
> 

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);
}


-- 




More information about the Digitalmars-d-bugs mailing list