Bug 16499 – Misleading error message for 'in' operator with wrong argument
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-15T19:30:00Z
Last change time
2017-07-07T17:16:19Z
Keywords
diagnostic
Assigned to
nobody
Creator
yshuiv7
Comments
Comment #0 by yshuiv7 — 2016-09-15T19:30:01Z
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.
Comment #1 by github-bugzilla — 2016-10-12T06:34:36Z