Deprecated Nullable.get warning with Appenders
drug
drug2004 at bk.ru
Fri Jan 31 07:52:07 UTC 2020
On 1/31/20 10:32 AM, FeepingCreature wrote:
> On Friday, 31 January 2020 at 07:16:49 UTC, FeepingCreature wrote:
>> Nullable!T has an assign overload for T. Nullable!T implicitly
>> converts to T via `.get`. As such, Nullable!T can be assigned
>> Nullable!T - in a way that is guaranteed to crash if Nullable is null,
>> but it *can* be done! (And the compiler will do it silently by
>> default.) Well, now `.get` is deprecated, so this hypothetical loop is
>> also deprecated... but it still *compiles*.
>>
>
> Correction to avoid it seeming worse than it is: the compiler will not
> do this by default. The problem with hasElaborateAssign is that it calls
> opAssign manually. (There *were* bugs where the compiler did this by
> default though, when it thought that was the way to convert between
> constnesses for instance, but they're fixed.)
See also https://forum.dlang.org/thread/znrvjuemkrstlascgmta@forum.dlang.org
More information about the Digitalmars-d
mailing list