http://d.puremagic.com/issues/show_bug.cgi?id=4558
Summary: To spot a possible bug in code that doesn't change a value Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: bearophile_h...@eml.cc --- Comment #0 from bearophile_h...@eml.cc 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; else 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------