June 25, 2023
https://issues.dlang.org/show_bug.cgi?id=24013

          Issue ID: 24013
           Summary: [REG 2.103.0] result of __traits(getOverloads) is not
                    converted to a delegate anymore
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: b2.temp@gmx.com

## Description

Code used to compile and works until version 2.103.0

The problem seems to be that `&overload`, with `overload` coming from `__traits(getOverloads,...)` is not converted to a delegate anymore.

## Code

```
module reg2103;

import std.traits, std.meta;

alias GenericDescriptor = PropDescriptor!int;

struct PropDescriptor(T)
{
    static if (!is(T == struct))
    {
        alias PropSetter = void delegate(T value);
        alias PropGetter = T delegate();
    }
    else
    {
        alias PropSetter = void delegate(T value);
        alias PropGetter = ref T delegate() return;
    }

    PropSetter _setter;
    PropGetter _getter;

    string _name;

    void define(PropSetter aSetter, PropGetter aGetter, string aName)
    {
        setter(aSetter);
        getter(aGetter);
    }

    void setter(PropSetter value)
    {
        _setter = value;
    }

    PropSetter setter(){return _setter;}

    void getter(PropGetter value)
    {
        _getter = value;
    }

    PropGetter getter(){return _getter;}

    void name(string value)
    {
        _name = value;
    }

    ref string name()
    {
        return _name;
    }
}

enum Set;
enum Get;

mixin template PropertyPublisherImpl()
{
    void*[] _publishedDescriptors;

    void collectPublicationsFromPairs(T)()
    {
        foreach (member; __traits(derivedMembers, T))
        foreach (overload; __traits(getOverloads, T, member))
        {
            alias Attributes = __traits(getAttributes, overload);
            enum bool getterAttrib = staticIndexOf!(Get, Attributes) != -1;
            enum bool setterAttrib = staticIndexOf!(Set, Attributes) != -1;
            // define the getter
            static if (getterAttrib)
            {
                alias Type = ReturnType!overload;
                auto descriptor = new PropDescriptor!Type;
                auto dg = &overload;
                descriptor.define(descriptor.setter, dg, member);
            }
        }
    }
}

void main()
{
    class Bar
    {
        size_t _field;
        mixin PropertyPublisherImpl;
        this()
        {
            collectPublicationsFromPairs!Bar;
        }
        @Set void field(size_t aValue)
        {
        }
        @Get size_t field()
        {
            return _field;
        }
    }
    auto _ = new Bar;
}
```

--