June 13, 2020
https://issues.dlang.org/show_bug.cgi?id=15634

Stanislav Blinov <stanislav.blinov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.blinov@gmail.com

--- Comment #1 from Stanislav Blinov <stanislav.blinov@gmail.com> ---
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)); // ???

--
June 15, 2020
https://issues.dlang.org/show_bug.cgi?id=15634

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
Yeah, I think this was a suggestion from someone because the code he used to do the same thing was really complex.

But later, someone posted a much simpler solution (just try passing the result into a ref lambda). I don't really need this. I should have closed it immediately. Thanks.

--