I feel incredibly stupid asking this one, but how does one extract the address of return value of a member function that returns by ref?

Case in point:

//----
struct S
{
    int i;
    ref front() @property
    {
        return i;
    }
}

void foo(int*){}

void main()
{
    auto s = S();
    static assert (hasLvalueElements!S);
    auto p = &(s.front);
writeln(typeof(p).stringof); //produces int delegate() @property ref
    foo(p);
}
//----
Error: function main.foo (int* _param_0) is not callable using argument types (int delegate() @property ref) Error: cannot implicitly convert expression (p) of type int delegate() @property ref to int*
//----
I want: the address of the value returned by s.front.
I get: the address of the function S.front.

:/

Reply via email to