March 07, 2017 [Issue 17245] New: Errors about expressions with no effect only are given for basic types | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=17245 Issue ID: 17245 Summary: Errors about expressions with no effect only are given for basic types Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: jack@jackstouffer.com Example void main () { Object a, b; a == b; } gives no error. The problem lies, as ketmar put it, with opEquals > oops. no more error messages. yes, i know that this invokes `opEquals()`, and `opEquals()` can have side-effects. but what are the chances of writing such code *intentionally*? Here, the compiler can be helpful by outputing an error if the used opEquals is marked as pure. There's no way that a pure opEquals should be used in an expression with no effect. -- |
Copyright © 1999-2021 by the D Language Foundation