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

           Summary: non-transitivity of inout breaks const system
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2011-11-08 16:03:34 PST ---
Consider:

int[] y;

inout(const(int)[]) foo(inout(int) x){
    y=new int[10];
    const(int)[] q = y;
    inout a = q;
    return a;
}

void main(){
    immutable int x;
    immutable int[] oops = foo(x);
    assert(is(typeof(oops[0]) == immutable));
    auto oldoops_0 = oops[0];
    y[0]++;
    assert(oops[0] != oldoops_0);
}


This is caused by the fact that !is(inout(const(int)[])==inout(int[])), i.e.
inout is currently non-transitive in certain cases and making it 'override'
const transitively will fix the issue.

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

Reply via email to