D-Programming-Language/phobos — pull request #675 by jmdavis (2012-07-09 05:10:28+00:00)
Title: Fix for issue# 8362.

"std.traits.isSafe doesn't work with unsafe lamdba functions"

`std.traits.isSafe` seems to have been fairly broken. It's first branch was done completely incorrectly and showed a lack of understanding of how `FunctionAttribute` works, and the second half didn't take into account that the function wouldn't compile if the argument was `@system`. Templatizing the function that it used to test would have fixed it, but I just fixed the first part so that it should work for everything.

The original problem was that something like

import std.traits;

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

void main()
{
auto s1 = S();
static assert(!isSafe!({auto r = s1.fun();}));
}

didn't compile, since the latter half of `isSafe` didn't work with `@system` at all.