[Issue 6930] combined type of immutable(T) and inout(T) should be inout(const(T))

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 10 11:17:19 PST 2011


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



--- Comment #2 from timon.gehr at gmx.ch 2011-11-10 11:16:41 PST ---
(In reply to comment #1)
> I'm not seeing a good use case here.
> 
> Can't you just do:
> 
> return condition ? x : new inout(int[])(2);

Is this better?

immutable(int[]) bar(){
    return new immutable(int[])(2);
}

inout(const(int[])) foo(inout(int[]) x){
    import std.random;
    bool condition = cast(bool)uniform(0,2);
    return condition ? x : bar();
}

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


More information about the Digitalmars-d-bugs mailing list