www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5030] New: Operators don't work with AssociativeArray!(T1,T2)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5030

           Summary: Operators don't work with AssociativeArray!(T1,T2)
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: cbkbbejeap mailinator.com



17:28:23 PDT ---
---------------------------
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 09 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5030


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



13:32:41 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 18 2012