www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Should this be flagged as a warning?

I just found a bug in my code that showed up in this fragment:

     match(ts, TokenType.OpenParen);
     ie.type == parseType(ts);

Obviously I meant

     ie.type = parseType(ts);

but wrote == because I'm an idiot. If parseType wasn't a function
with side effects, -w would have flagged it as an expression with
no effect. But the comparison still has no side effects. Thoughts?

-Bernard.

p.s. as a side note, I think this is the first time I've had a bug
from writing == where I meant = instead of the other way around!
Sep 24 2012