[Issue 6624] New: Functions with Parameters Implicitly Convertible to Immutable Are Not Pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 8 07:00:59 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6624

           Summary: Functions with Parameters Implicitly Convertible to
                    Immutable Are Not Pure
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-09-08 07:00:45 PDT ---
Using 2.055, where you're allowed to implicitly convert return values of
strongly pure functions to immutable.  

char[] foo(string s) pure {
    return s.dup;
}

void main() {
    string dummy;
    string s = foo(dummy);
}

D:\home\dsimcha\bin\test.d(7): Error: cannot implicitly convert expression
(foo(dummy)) of type char[] to string

If I change the signature to:

char[] foo(immutable string s) pure 

then it works.

-- 
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