[Issue 19616] Result type of ternary operator connecting pointers/slices of class handles broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 6 21:18:23 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19616

--- Comment #1 from Bolpat <qs.il.paperinik at gmail.com> ---
The same is true for interfaces:

interface I { }
interface A : I { }
bool condValue;
bool cond() { return condValue; }

pragma(msg, typeof(cond() ? &a : cond() ? &b : &i)); // I*
I* iPtr = cond() ? &a : &i; // fails with error message: cannot assign I* to I*
const(I)* iPtr = cond() ? &a : &i; // succeeds
(cond() ? a : i) = i; // succeeds and breaks @safe

--


More information about the Digitalmars-d-bugs mailing list