[Issue 16499] New: Useless error message for 'in' expressions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 15 12:30:01 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16499

          Issue ID: 16499
           Summary: Useless error message for 'in' expressions
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: yshuiv7 at gmail.com

struct B {
    int k;
    void* opBinaryRight(string op)(int x) if (op == "in") {
        return &k;
    }
}
void main() {
    B c;

    import std.stdio;
    writeln(10 in c);
    writeln(1.0 in c);
}

The error reported is:

"Error: rvalue of in expression must be an associative array, not B"

Which is not true, and useless.

--


More information about the Digitalmars-d-bugs mailing list