https://issues.dlang.org/show_bug.cgi?id=22775
--- Comment #3 from Walter Bright <[email protected]> --- The attached example: -------------------------- import std.traits; import std.meta; struct S { int x; } @safe interface I { int func(ref scope S s) @nogc; } @safe class C : I { int func(ref S s) { return 2*s.x; } } @safe class Cscope : I { int func(ref scope S s) { return 2*s.x; } } @safe class Cconst : I { int func(ref const S s) { return 2*s.x; } } @safe struct ST { int func(ref S s) { return 2*s.x; } } @safe struct STscope { int func(ref scope S s) { return 2*s.x; } } @safe struct STconst { int func(ref const S s) { return 2*s.x; } } alias getMemberType(alias O, string name)=typeof(__traits(getMember, O, name)); static unittest { pragma(msg, I, " : ", getMemberType!(I, "func")); pragma(msg, C, " : ", getMemberType!(C, "func")); pragma(msg, Cscope, " : ", getMemberType!(Cscope, "func")); pragma(msg, Cconst, " : ", getMemberType!(Cconst, "func")); pragma(msg, getMemberType!(Cscope, "func").stringof); static assert(getMemberType!(Cscope, "func").stringof == q{@nogc @safe int(ref scope S s)}); } static unittest { pragma(msg, ST, " : ", getMemberType!(ST, "func")); pragma(msg, STscope, " : ", getMemberType!(STscope, "func")); pragma(msg, STconst, " : ", getMemberType!(STconst, "func")); static assert(getMemberType!(STscope, "func").stringof == q{@safe int(ref scope S s)}); } --
