www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6690] New: Using lazy parameter is inferred as unsafe

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: k.hara.pg gmail.com



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: -------
Sep 18 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6690


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Summary|Using lazy parameter is     |Using lazy parameter should
                   |inferred as unsafe          |be inferred as  safe



https://github.com/D-Programming-Language/dmd/pull/391

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6690


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



00:16:45 PDT ---
https://github.com/D-Programming-Language/dmd/commit/e4fd82fb2c3c2aa5101c8def177ed4e9937e302e

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 21 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6690


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm gmail.com



*** Issue 6328 has been marked as a duplicate of this issue. ***

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