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

--- Comment #0 from 2011-11-08 16:03:34 PST ---

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];
    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:
------- You are receiving this mail because: -------

Reply via email to