https://issues.dlang.org/show_bug.cgi?id=17284
--- Comment #4 from [email protected] --- Interesting. So it would appear that the problem is caused by attribute inference wrongly inferring @safe for a template function that returns an overlapping pointer field. I.e.: ---- class C { } union U { C c; int i; } ref C func(T)(ref T t) { return t.c; } pragma(msg, typeof(func!U)); ---- Compiler output: ---- pure nothrow @nogc ref @safe C(return ref U t) ---- The correct inferred type should be: ---- pure nothrow @nogc ref @system C(return ref U t) ---- --
