[Issue 8408] New: Purity calculation should be improved

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 22 05:27:38 PDT 2012


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

           Summary: Purity calculation should be improved
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-07-22 05:27:35 PDT ---
If the argument values that given to a function marked as pure doesn't appear
in its return value, then the function should become 'strong purity'.

An example:

int[] func(const(int)[] arr) pure;

The parameter 'arr' refers const integers through its slice, but func returns
int[], so func cannot return arr directly (without unsafe cast) and becomes
'strong purity' function.

The parameter 'arr' refers const integers through its slice, but func returns
int[]. const(int)[] is not implicitly convertible to int[], then func cannot
return arr directly (without unsafe cast like cast(int[]) arr) and becomes
'strong purity' function.

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