[Issue 24569] New: operator overloading on pointer to value-type instances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 27 10:48:57 UTC 2024


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

          Issue ID: 24569
           Summary: operator overloading on pointer to value-type
                    instances
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

Maybe this should work

```d
struct S
{
    void opOpAssign(string op, T)(T t) { }
}

void main()
{
    S a;
    a ~= 0; // OK

    auto b = &a;
    b.opOpAssign!"~"(0); // OK

    b ~= 0; // NG, but maybe should ?
}      
```

The idea is that usually member functions are supposed to work on pointers to
instances implementing these functions.

--


More information about the Digitalmars-d-bugs mailing list