www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12110] New: [CTFE] Error: CTFE internal error: Dotvar assignment

https://d.puremagic.com/issues/show_bug.cgi?id=12110

           Summary: [CTFE]  Error: CTFE internal error: Dotvar assignment
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dmitry.olsh gmail.com



11:13:28 PST ---
Dustmited from std.uni:

//---start---
struct SliceOverIndexed
{
 property empty(){ return from ; }

 property front(){ return (*arr)[from]; }

 property front(Item val) { (*arr)[from] = val; }

void popFront() {   }

alias typeof(Uint24Array.init[0]) Item;
size_t from, to;
Uint24Array* arr;
}

uint read24(ubyte* ptr, size_t idx)
{
return ptr[idx] + ptr[idx+1];
}

struct Uint24Array
{
this(Range)(Range range)
{
    length = range.length;
    this[].front = range[0];
}

 property length() {
return data.length ? data.length-4: 0;
}

 property length(size_t len)
{
immutable bytes = len*3+4;
data = new ubyte[bytes];
}

uint opIndex(size_t idx){
return read24(data.ptr, idx);
}

void opIndexAssign(uint , size_t )
{
    dupThisReference();
}

auto opSlice()
{
    return SliceOverIndexed(0, length, &this);
}

void dupThisReference( )
{
auto new_data = new ubyte[data.length];
data = new_data;
}

ubyte[] data;
}

static m2 = Uint24Array([0x80]);
//---end---

DMD64 D Compiler v2.065-devel-723cc20
Output:

n_test.d(56): Error: CTFE internal error: Dotvar assignment
n_test.d(45):        called from here: this.dupThisReference()
n_test.d(7):        called from here: (*this.arr).opIndexAssign(val, this.from)
n_test.d(26):        called from here: this.opSlice().front(cast(uint)range[0])
n_test.d(62):        called from here: (Uint24Array __ctmp1;
 , __ctmp1).this([128])

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2014