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

          Issue ID: 18743
           Summary: Conditional expression (ternary operator) can evaluate
                    the third expression even "If it is true"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: acehr...@yahoo.com

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

Copied from the forum discussion:

  https://forum.dlang.org/post/rjcjecmgrpeqbdrht...@forum.dlang.org

The behavior does not match the spec:

  https://dlang.org/spec/expression.html#conditional_expressions

Ali

--

Reply via email to