[Issue 21518] delegates not checked for attribute match in const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 1 20:43:32 UTC 2021


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

--- Comment #2 from moonlightsentinel at disroot.org ---
Also not restricted (In reply to moonlightsentinel from comment #1)
> This issue is not restricted to function parameters:
> 
> void delegates()
> {
>     const dg = delegate() @system { int* p; int x; p = &x; };
>     // pragma(msg, typeof(dg)); // const(void delegate() pure nothrow @nogc
> @system)
>     
>     // No error
>     const(void delegate() @safe)[] arg = [ dg ];
>     // pragma(msg, typeof(arg)); // const(void delegate() @safe)[]
>     
>     // Correctly fails
>     // void delegate() @safe[] arg = [ dg ];
> }

Also missing:

    const(void delegate() @system)[] sysA = [ dg ];
    const(void delegate() @safe)[] safeA = sysA;

--


More information about the Digitalmars-d-bugs mailing list