[Issue 2532] New: '=' does not give a boolean result

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 21 09:04:46 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2532

           Summary: '=' does not give a boolean result
           Product: D
           Version: 2.022
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: adolf.mathias at googlemail.com


Using a boolean assignment in an if condition e.g. as follows gives IMHO an
unjustified error message. When a new variable is declared in the if()
condition, everything is OK:

// tst.d
void main()
{ bool b;

  if(b=false) { b = true; }
  if(bool c=false) { c = true; }
}

$ dmd tst
tst.d(4): Error: '=' does not give a boolean result


-- 



More information about the Digitalmars-d-bugs mailing list