[Issue 7577] New: Delegate implicitly marked as system
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 24 19:22:25 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7577
Summary: Delegate implicitly marked as system
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: iteronvexor at gmail.com
--- Comment #0 from iteronvexor at gmail.com 2012-02-24 19:22:24 PST ---
----------------8<----------------8<----------------
import std.datetime;
import std.stdio;
struct A{
auto fun(A a){ return 0; }
}
void bench(alias fun)(string msg, uint n = 1_000_000){
auto b = benchmark!fun(n);
writefln(" %s %s ms", msg, b[0].to!("msecs", int));
}
unittest{
A a, b;
void test1(){
auto r = a.fun(b);
}
bench!( {auto r = a.fun(b);} )("Does Not work");
bench!(test1)("Works");
}
void main(){ }
---------------->8---------------->8----------------
DMD 2.058, GNU/Linux 64-bit
/usr/include/d/dmd/phobos/std/datetime.d(30986): Error: safe function
'benchmark' cannot call system delegate '__lambda1'
t1.d(11): Error: template instance
t1.__unittest2.benchmark!(__lambda1) error instantiating
t1.d(23): instantiated from here: bench!(delegate @system void()
{
int r = a.fun(b);
}
)
t1.d(23): Error: template instance t1.__unittest2.bench!(delegate @system
void()
{
int r = a.fun(b);
}
) error instantiating
--
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