Thread overview
[Issue 6690] New: Using lazy parameter is inferred as unsafe
Sep 18, 2011
Kenji Hara
[Issue 6690] Using lazy parameter should be inferred as @safe
Sep 18, 2011
Kenji Hara
Sep 21, 2011
Walter Bright
Dec 22, 2011
Kenji Hara
September 18, 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@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@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: -------
September 18, 2011
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


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-09-18 15:31:19 PDT ---
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: -------
September 21, 2011
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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2011-09-21 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: -------
December 22, 2011
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


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-21 19:31:25 PST ---
*** 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: -------