[Issue 10926] Wrong expression printed when ternary operator used as lvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 12 10:00:11 PST 2013


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



--- Comment #3 from bearophile_hugs at eml.cc 2013-11-12 10:00:09 PST ---
(In reply to comment #2)
> No rejects-valid here, it simply prints the wrong expression.
> 
> https://github.com/D-Programming-Language/dmd/pull/2750

Please help me understand. This is a reduced test code:


void main() {
    const(int)[] a;
    int[] c;
    (true ? a : c) ~= 20;
}


Before this fix it gave:
temp.d(4): Error: a is not an lvalue

Now it gives:
temp.d(4): Error: cast(const(int)[])c is not an lvalue

How is the error message improved? c is a fully mutable array.

Why isn't this output a rejects-valid still? Both a and c can be appended. The
common type between a and c should be const(int)[], that is appendable.

(If I receive no good answer I'll reopen this issue later.)

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


More information about the Digitalmars-d-bugs mailing list