Bug 5030 – Operators don't work with AssociativeArray!(T1,T2)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-10-09T17:28:00Z
Last change time
2014-05-30T01:09:28Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla
Comments
Comment #0 by bus_dbugzilla — 2010-10-09T17:28:23Z
---------------------------
import std.stdio;
void main()
{
string[string] aa1;
AssociativeArray!(string,string) aa2;
if("" in aa1) {} // Ok
if("" in aa2) {} // Error
aa1[""] = ""; // Ok
aa2[""] = ""; // Error
}
---------------------------
Result:
---------------------------
testAA.d(8): Error: rvalue of in expression must be an associative array, not AssociativeArray!(string,string)
testAA.d(11): Error: no [] operator overload for type AssociativeArray!(string,string)
---------------------------
This might be related to issue 4723: http://d.puremagic.com/issues/show_bug.cgi?id=4723
This is particularly problematic for metaprogramming due to issue 5029.
Comment #1 by andrej.mitrovich — 2012-12-18T13:32:41Z
Since Issue 5029 is fixed, should we close this?
I mean we could define opIn_r and opIndexAssign, but I don't know if it's worth it.
Comment #2 by k.hara.pg — 2014-05-30T01:09:28Z
Fixed in 2.066 git-head. Now AssociativeArray!(string,string) is just an alias of the type string[string] .