Summary: opBinaryRight for "in" doesn't work right
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Steven Schveighoffer <> 2010-09-28 
14:13:57 PDT ---
Given this struct:

struct S
    short _x;
    bool opBinaryRight(string op)(short x) if (op == "in")
        return x == _x;

void main()
    S s;
    5 in s;

This produces the error:

testopin.d(13): Error: rvalue of in expression must be an associative array,
not S

But change the type of x to int, and it works.  However, the type of the
argument should play no role in whether the template can be instantiated.  It
seems this is the error message that is given when a type does not support
opIn, so the error message is very bad too.

Slightly related, but not the same issue: bug 3905

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

Reply via email to