[Issue 4953] New: opBinaryRight for "in" doesn't work right
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 28 14:14:12 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4953
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
AssignedTo: nobody at puremagic.com
ReportedBy: schveiguy at yahoo.com
--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list