[Issue 24265] ref delegate no longer implicitly converts to unannotated type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 29 20:07:24 UTC 2023


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

--- Comment #4 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Looks like this only happens when the return attribute is inferred.

---
void test()
{
    int a;

    ref int f();
    ref int g() return;
    ref int h() => a; // return inferred
    typeof(&f) dg;
    dg = &g; // line 9
    dg = &h; // line 10
}
---

Output:

---
bug.d(9): Error: cannot implicitly convert expression `&g` of type `int
delegate() ref return` to `int delegate() ref`
bug.d(10): Error: cannot implicitly convert expression `&h` of type `int
delegate() pure nothrow @nogc ref @safe` to `int delegate() ref`
---

--


More information about the Digitalmars-d-bugs mailing list