[Issue 8362] New: safe function 'benchmark' cannot call system function literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 8 17:41:29 PDT 2012


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

           Summary: safe function 'benchmark' cannot call system function
                    literal
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: iteronvexor at gmail.com


--- Comment #0 from Caligo <iteronvexor at gmail.com> 2012-07-08 17:41:22 PDT ---
----------------------->8---------------------->8---------------------------
import std.datetime;

void ben(alias fun)() { auto b = std.datetime.benchmark!fun(1); }

struct S{ auto fun() { return 1; } }

unittest {
  auto s1 = S();
  ben!( {auto r = s1.fun();} )();
}

void main() { }
-----------------------8<----------------------8<---------------------------

compiling with `dmd -unittest t1.d` we get:


/home/a/Code/D/compiler/phobos/std/datetime.d(30901): Error: safe function
'benchmark' cannot call system function literal '__lambda1'
t1.d(3): Error: template instance t1.__unittest2.benchmark!(__lambda1) error
instantiating
t1.d(9):        instantiated from here: ben!(delegate @system void()
{
int r = s1.fun();
}
)
t1.d(9): Error: template instance t1.__unittest2.ben!(delegate @system void()
{
int r = s1.fun();
}
) error instantiating
/home/a/Code/D/compiler/phobos/std/traits.d(748): Error: safe function
'dummySafeFunc' cannot call system function literal '__lambda1'

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