May 06, 2022
https://issues.dlang.org/show_bug.cgi?id=23096

          Issue ID: 23096
           Summary: return auto ref does wrongly inferred with member
                    function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: jlourenco5691@gmail.com

The member function returns a ref instead of an lvalue.

```
struct Foo
{
    auto ref get() { return i; }
        int i;
}

auto ref get()(auto ref Foo foo) { return foo.i; }

void main()
{
    static assert(!__traits(compiles, &get(Foo(4)))); // ok
    static assert(!__traits(compiles, &Foo(4).get())); // fails
}
```

This probably happens because this bit of code does not fail also

```
struct Foo
{
    ref get() { return i; }
    int i;
}

void main()
{
    auto p = &Foo(4).get;
}
```

--