[Issue 18743] New: Conditional expression (ternary operator) can evaluate the third expression even "If it is true"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 7 15:25:02 UTC 2018
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: nobody at puremagic.com
Reporter: acehreli at 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/rjcjecmgrpeqbdrhtgvq@forum.dlang.org
The behavior does not match the spec:
https://dlang.org/spec/expression.html#conditional_expressions
Ali
--
More information about the Digitalmars-d-bugs
mailing list