www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8980] New: no implicit cast to const for AA


           Summary: no implicit cast to const for AA
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: puremagic mikevandongen.nl

--- Comment #0 from Mike van Dongen <puremagic mikevandongen.nl> 2012-11-08
07:21:12 PST ---
In the following example I'm trying to compare 2 AA's of which 1 is const.

const string[string] a = ["lang": "D"];
string[string] b = ["lang": "D"];
assert(a == b);

The compiler gives the following error:
Error: incompatible types for ((a) == (b)): 'const(immutable(char)[][string])'
and 'string[string]'

When I explicitly cast b to const, it does work.

assert(a == cast(const) b);

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