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: [email protected]
          Reporter: [email protected]

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/[email protected]

The behavior does not match the spec:

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

Ali

--

Reply via email to