On Saturday, 7 April 2018 at 15:26:56 UTC, Ali Çehreli wrote:
On 04/07/2018 02:07 AM, sdvcn wrote:
     string stt = "none";
     true?writeln("AA"):writeln("BB");   ///Out:AA
         true?stt="AA":stt="BB";    <<<<-----///Out:BB
     writeln(stt);


It is a bug because the behavior does not match the spec:

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

Ali

Hi Ali C

I think it also a bug because the ternary seem to be returning the second part

try

    string stt = "none";
    string b = "";
    true?writeln("AA"):writeln("BB");   ///Out:AA
    b = (true ? stt="AA":stt="BB");    ///Out:BB
    writeln(stt);
    writeln(b); ///Out:BB

Reply via email to