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

           Summary: [CTFE] inout + returning a pointer into a member array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Dmitry Olshansky <[email protected]> 2013-11-17 
01:49:04 PST ---
Somewhat reduced test case:

struct MultiArray
{
    this(size_t[] sizes...)
    {
        storage = new size_t[5];
    }

    @property auto raw_ptr()inout //removing inout helps
    {
        return storage.ptr+1;
    }
    size_t[] storage;
}

enum test = (){
    auto m = MultiArray(3,2,1);
    auto start = m.raw_ptr;   //this trigger the bug
    //auto start = m.storage.ptr + 1; //this obviously works
    return 0;
}();

Output:
bug_ctfe.d(17): Error: cannot cast [0u, 0u, 0u, 0u, 0u][1] to uint* at compile
time

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

Reply via email to