Summary: To spot a possible bug in code that doesn't change a
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-08-01 14:20:33 PDT ---
This is a semantically wrong D2 program, the programmer has used a "&=" instead
of "|=" to build a flag result:

enum Flags { NONE   = 0b00,
             FIRST  = 0b01,
             SECOND = 0b10
Flags foo(int x) {
    Flags result = Flags.NONE;
    if (x < 10)
        result |= Flags.FIRST;
        result &= Flags.SECOND; // line 10
    return result;
void main() {}

The D compiler can find this problem in the code at line 10 because in that
program the variable "result" is certantly zero after the assignment with
Flags.SECOND, so it's an error or it's useless code.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to