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



--- Comment #5 from [email protected] 2013-11-12 10:29:09 PST ---
(In reply to comment #4)

> Would this make any sense?
> 
> (cast(const(int)[])c) ~= 20;


You are probably right, but it's quite surprising:


void main() {
    const(int)[] a, b;
    int[] c, d;
    (true ? a : b) ~= 10; // OK
    (true ? c : d) ~= 20; // OK
    (true ? a : c) ~= 30; // Error: cast(const(int)[])c is not an lvalue
    if (true)
        a ~= 40; // OK
    else
        c ~= 40; // OK
}


So if both are fully mutable, or both have const items then you can append to
them, but if one of them is mutable and the other has const items, then it
can't append and you have to use a regular if statement.

Thank you for your answer, I'll keep this issue closed.

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

Reply via email to