Problems with std.traits.isSafe & SafeD
Johannes Pfau
spam at example.com
Sun Dec 12 05:55:11 PST 2010
Hmm, next problem with safe D.
unittest
{
@safe int tf(int i){return i;}
bool a = isSafe!(tf);
assert(a == true);
static assert(isSafe!(tf));
static assert(isSafe!(typeof(&tf)));
}
All three asserts fail! Even the example from std.traits doesn't work for
me, isSafe always returns false. And the last assert causes another
problem:
------------------------------------------------------------------------------
event.d(170): Error: template instance isSafe!(int delegate(int i)) does
not match template declaration isSafe(alias func)
------------------------------------------------------------------------------
So it's not possible to check the safety of a delegate Type? It seems like
isSafe just doesn't support this use case, maybe it could be added, but
why is "typeof(&tf)" "int delegate(int i)"? Shouldn't @safe be somewhere
in that type?
--
Johannes Pfau
More information about the Digitalmars-d-learn
mailing list