Skip to content

Relax @safe restrictions on opAssign#70

Merged
pbackus merged 1 commit intomasterfrom
safer-opassign
Aug 20, 2021
Merged

Relax @safe restrictions on opAssign#70
pbackus merged 1 commit intomasterfrom
safer-opassign

Conversation

@pbackus
Copy link
Owner

@pbackus pbackus commented Aug 20, 2021

Overwriting a SumType's value with a pointer can be @safe so long as the
old value is known, at compile time, to be either (a) a non-pointer, or
(b) a pointer of the same type as the new value. This change allows such
assignments in @safe code, while still forbidding other assignments that
overwrite pointers.

See also:

Fixes #67 on Github.

Overwriting a SumType's value with a pointer can be @safe so long as the
old value is known, at compile time, to be either (a) a non-pointer, or
(b) a pointer of the same type as the new value. This change allows such
assignments in @safe code, while still forbidding other assignments that
overwrite pointers.

See also:
  - https://issues.dlang.org/show_bug.cgi?id=22225
  - dlang/phobos#8201

Fixes #67 on Github.
@pbackus pbackus merged commit ee7e591 into master Aug 20, 2021
@pbackus pbackus deleted the safer-opassign branch August 20, 2021 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some assignments should be able to execute in safe code

1 participant