[Issue 18672] Error in @safe transitive propagation with associative arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 27 21:22:16 UTC 2018


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

ag0aep6g <ag0aep6g at gmail.com> changed:

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

--- Comment #2 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Seb from comment #1)
> So DMD already does transitively apply @safe, but apparently if it generated
> for associative arrays this generation doesn't work in all cases.

It's not the associative array. It's just that the generated opAssign isn't
@safe (for no reason):

----
void main() @safe
{
    struct ThrowingElement
    {
        ~this() {}
    }

    ThrowingElement aa;
        /* Accepted. The destructor is apparently inferred as @safe. */
    aa = aa;
        /* Error: @safe function D main cannot call @system generated
        function onlineapp.main.ThrowingElement.opAssign */
}
----

--


More information about the Digitalmars-d-bugs mailing list