www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23779] New: UFCS using pointer should be allowed and should

https://issues.dlang.org/show_bug.cgi?id=23779

          Issue ID: 23779
           Summary: UFCS using pointer should be allowed and should
                    automatically take a reference on values
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryuukk.dev gmail.com

This code:

```
struct Data
{
    int value;
}

void something(Data* data)
{
    data.value++;
}

void main()
{
    Data d;
    Data* ptr = &d;

    ptr.something();  // works
    (&d).something(); // works, but the syntax looks bad
    d.something();    // doesn't work, compiler should do what i do above and
allow it
}
```

It is similar to the request here:
https://issues.dlang.org/show_bug.cgi?id=8597

But  it's the opposite, if the function is declared by accepting a pointer,
then this example should be allowed

--
Mar 14 2023