[Issue 21856] Implicit @safe violation of immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 27 10:26:44 UTC 2021


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
The error does not have anything to do with `@safe`. The fundamental issue is
that the implicit conversion is not signaled appropriately. If `f` is not
templated:

immutable(D) f(DA right) {
    D ret = right;
    return ret;
}

The compiler correctly errors: test.d(6): Error: cannot implicitly convert
expression `ret` of type `test.D` to `immutable(D)`

--


More information about the Digitalmars-d-bugs mailing list