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
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/573ab09aac2e59225e86440702a3769761734f15 Merge pull request #6140 from yshui/master fix issue 16499 - error message for 'in' expression
Comment #2 by github-bugzilla — 2016-11-04T09:05:28Z
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/573ab09aac2e59225e86440702a3769761734f15 Merge pull request #6140 from yshui/master
Comment #3 by github-bugzilla — 2017-01-07T03:02:21Z
Commit pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/573ab09aac2e59225e86440702a3769761734f15 Merge pull request #6140 from yshui/master
Comment #4 by dlang-bugzilla — 2017-07-07T17:16:19Z
*** Issue 3905 has been marked as a duplicate of this issue. ***