https://issues.dlang.org/show_bug.cgi?id=15634
Stanislav Blinov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Stanislav Blinov <[email protected]> --- Stumbled on this via a forum thread (four years later, yay), and honestly I find this request rather strange. There is a trait that provides such information for functions - the getFunctionAttributes. It already existed at the time of this issue report, and is even touched upon in aforementioned forum thread, albeit in Phobos disguise. However, the "some alias/member" may be (among others): - an overloaded function - a function template with auto ref parameters In both of those cases, a __trait won't be able to provide the information required, since symbol alone is simply insufficient. Overloads would need to be tested one by one, carefully matching arguments; templates would have to be instantiated, again carefully matching arguments. Consider: struct S { string x; // NOTE: y is overloaded void y() {} ref y(return ref int z) { return z; } float y(float z) { return z; } // whether it returns rvalue or lvalue depends on what is passed auto ref tpl(Args...)(auto ref Args args) { static if (args.length) return args[0]; } } static assert(__traits(hypotheticalIsLvalue, S.y)); // which `y` ??? static assert(__traits(hypotheticalIsLvalue, S.tpl)); // ??? --
