www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6811] New: Confusion between string* and immutable(char)*, related to AA's

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

           Summary: Confusion between string* and immutable(char)*,
                    related to AA's
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



void doExclude(string exclude) {
    string[string] aa;

    int[] keep;
    foreach(int i, h; ["a", "b"]) {
        auto ptr = h in aa;
        pragma(msg, typeof(ptr));  // string*
        pragma(msg, typeof(*ptr)); // string
        if(*h != exclude) keep ~= i;
    }
}

test.d(9): Error: incompatible types for ((*cast(immutable(char)*)h) !=
(exclude)): 'immutable(char)' and 'string'

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


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



(Slaps self in forehead.)  Never mind, I see what I did now.  I used *h where I
meant *ptr and forgot that strings implicitly convert to char*.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2011