[Issue 6690] New: Using lazy parameter is inferred as unsafe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 18 15:25:41 PDT 2011


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

           Summary: Using lazy parameter is inferred as unsafe
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          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> 2011-09-18 15:25:16 PDT ---
We cannot use std.exception.enforceEx in @safe function.

import std.exception;
void test1() @safe
{
    enforceEx!Exception(true, "");
    // Error: safe function 'test1' cannot call system function 'enforceEx'
}

This is dmd bug, using lazy parameter is inferred as unsafe, so whole enforceEx
calling is inferred as unsafe.

More simple test case.

T useLazy(T)(lazy T val)
{
    return val;
}
void test2() @safe
{
    useLazy(0);
    // Error: safe function 'test2' cannot call system function 'useLazy'
}

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