Should this be flagged as a warning?

bearophile bearophileHUGS at lycos.com
Tue Sep 25 14:16:10 PDT 2012


Bernard Helyer:

>     match(ts, TokenType.Is);
>     match(ts, TokenType.OpenParen);
>     isExp.type == parseType(ts);
>
> The bug being of course, that a type is parsed and ts is 
> modified, so the expression has side effects so it's not
> flagged as a useless expression. But the comparison still
> has no effect, so should this be flagged by DMD?

The top level operation is the ==, that is a pure expression, so 
maybe dmd should warn on this.

Bye,
bearophile


More information about the Digitalmars-d mailing list