Non-techincal brain, is @safe by default good or not?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu May 28 10:46:08 UTC 2020
On 5/28/20 6:28 AM, Mathias LANG wrote:
>
> import std.algorithm.mutation;
> struct S
> {
> void opPostMove(const ref S old) @system nothrow pure
> {
> int* ptr = cast(int*)42;
> *ptr = 42;
> }
> int a;
> }
> void main () @safe nothrow
> {
> S s1;
> s1.a = 41;
> S s2 = move(s1); // BOOM
> assert(s2.a == 42);
> }
> ```
>
> This compiles and crash just fine.
At least this is a legit bug report.
More information about the Digitalmars-d
mailing list