Summary: Wrong error message with wrong opBinary("in")
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-03-08 16:10:09 PST ---
This D2 program is wrong, because it needs a opBinaryRight to work:

struct Group {
    int i1, i2;
    bool opBinary(string s:"in")(int x) { 
        return x == this.i1 || x == this.i2;
auto enum r = 3 in Group(1, 2);
void main() {}

But the compiler gives a bad error message, that doesn't help the programmer
much (and there are no associative arrays in this program):

test.d(7): Error: rvalue of in expression must be an associative array, not

For example a better error message can be:

test.d(7): Error: Group has no opBinaryRight("in") operator and int has no
opBinary("in") operator.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to