Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix #18977] disallow change branch of an object variant in ARC again #19510

Closed
wants to merge 8 commits into from

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Feb 10, 2022

fix #18977

todo

  • make {.cast(uncheckedAssign).} work

@Araq
Copy link
Member

Araq commented Mar 23, 2022

I don't understand this.. You merely updated some tests?

@ringabout
Copy link
Member Author

Yeah, I haven't figured out a solution.

@ringabout ringabout closed this Aug 8, 2022
@ringabout ringabout deleted the pr_dis branch August 8, 2022 09:00
@planetis-m
Copy link
Contributor

fyi, the discriminator destructor is not enough to ensure use after free bugs from happening, I have a ton in my project. One needs to emit this code instead:

if a.kind != tmpkind:
  case a.kind
  of X: # only destroy X fields (no reset)
  of Y: # only destroy Y fields
  a.kind = tmpKind
  case a.kind
  of X: # reset X fields
  of Y: # reset Y fields

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.

Change branch of an object variant is allowed
3 participants