[Issue 15384] New: assignment is sometimes still accepted as a condition
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Nov 27 00:24:32 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15384
Issue ID: 15384
Summary: assignment is sometimes still accepted as a condition
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/
OS: All
Status: NEW
Severity: minor
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: eponymousalias at yahoo.com
Problem seen with: DMD64 D Compiler v2.067.1
bool cond = true;
do {
// stuff
} while (cond = false);
yields:
Error: assignment cannot be used as a condition, perhaps == was meant?
But:
bool cond = true;
do {
// stuff
} while (cond = false, cond = false);
passes the compiler without complaint, even though it also uses an
assignment as a condition.
--
More information about the Digitalmars-d-bugs
mailing list