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

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.

--

Reply via email to