[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:40:49 UTC 2023


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|diagnostic                  |

--- Comment #5 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Correction, it's not a diagnostic problem--the types are printed differently
because they are actually considered different by the compiler. For example,
this:

---
void test()
{
    int local;

    ref int explicit() pure nothrow @nogc @safe return;
    ref int inferred() pure nothrow @nogc @safe => local;
    static assert(is(typeof(&explicit) == typeof(&inferred)));
}
---

...fails with the following output:

---
bug.d(7): Error: static assert:  `is(int delegate() pure nothrow @nogc ref
return @safe == int delegate() pure nothrow @nogc ref @safe)` is false
---

The return attribute is not printed because it is genuinely not being inferred,
probably due to issue 22977.

--


More information about the Digitalmars-d-bugs mailing list