Skip to content

[6.2] [Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code #81467

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

Conversation

DougGregor
Copy link
Member

  • Explanation: For @objc enum, there's a synthesized call to unsafeBitCast(_:to:), which is obviously unsafe, and is being diagnosed as such by the strict memory safety mode. The compiler generates this call, so have the compiler also generate the unsafe around it to suppress these warnings.
  • Scope: Limited to synthesized code for @objc enum.
  • Issues: rdar://151199011
  • Original PRs: [Strict memory safety] Squash warning about unsafety in "@objc enum" synthesized code #81466
  • Risk: Very low. The introduced unsafe expression has no semantic effect other than squashing a warning.
  • Testing: CI

…synthesized code

There's a synthesized call to unsafeBitCast(_:to:), which is obvious
unsafe, and is being diagnosed as such. The compiler generates this
call, so have the compiler also generate the `unsafe` around it to
suppress these warnings.

Fixes rdar://151199011.
@DougGregor DougGregor requested a review from a team as a code owner May 13, 2025 04:35
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor enabled auto-merge May 13, 2025 04:35
@DougGregor DougGregor merged commit a98ea99 into swiftlang:release/6.2 May 13, 2025
5 checks passed
@DougGregor DougGregor deleted the objc-enum-unsafe-bit-cast-warning-6.2 branch May 13, 2025 15:14
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.

2 participants