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: nob...@puremagic.com
        ReportedBy: iteronve...@gmail.com


--- Comment #0 from Caligo <iteronve...@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: -------

Reply via email to