The following errors:
structopeq.d(15): Error: the result of the equality expression x == 1 is discarded
It also errors for x++ == 1;, even though that has a side-effect.
This could be extended for EqualExpression when lowering to opEquals:
struct S
{
bool opEquals(int);
}
void main()
{
S s;
s == 1; // currently allowed, should error
}
Similar to the PR to disallow discarded assignment, this should still error even if opEquals may have a side-effect.
The following errors:
It also errors for
x++ == 1;, even though that has a side-effect.This could be extended for EqualExpression when lowering to
opEquals:Similar to the PR to disallow discarded assignment, this should still error even if
opEqualsmay have a side-effect.