Bug 7837 – A refused opBinaryRight("in") with bad error message

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-04-05T17:49:00Z
Last change time
2013-01-16T07:14:10Z
Keywords
diagnostic, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-04-05T17:49:50Z
immutable struct Foo { bool opBinaryRight(string op="in")(int x) { return true; } } void main() { assert(5 in Foo()); } DMD 2.059beta gives: test.d(7): Error: rvalue of in expression must be an associative array, not Foo If this isn't a bug (maybe caused by fixing Issue 7038 ), then this issue is a diagnostic enhancement request for a better error message :-)
Comment #1 by yebblies — 2013-01-16T07:14:10Z
*** This issue has been marked as a duplicate of issue 3905 ***