[Issue 21545] [dip1000] cannot assign ref returning delegate to variable with lower attributes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 13 22:25:18 UTC 2021


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
Bizarre:

void main()
{
    int i;
    auto dg = delegate ref() @safe => i;

    alias DgFull = ref int delegate() pure nothrow @nogc @safe;
    alias DgAuto = typeof(dg);

    pragma(msg, DgFull); /* int delegate() pure nothrow @nogc ref @safe */
    pragma(msg, DgAuto); /* int delegate() pure nothrow @nogc ref @safe */
    pragma(msg, is(DgFull == DgAuto)); /* true; okay */

    alias DgSafe = ref int delegate() @safe;

    pragma(msg, is(DgFull : DgSafe)); /* true; okay */
    pragma(msg, is(DgAuto : DgSafe)); /* false; wat */
}

--


More information about the Digitalmars-d-bugs mailing list