Skip to content

Concurrency: Use std::bit_cast over ignoring -Wcast-function-type-mismatch #79036

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

Closed
wants to merge 2 commits into from

Conversation

tshortli
Copy link
Contributor

Building on #78985, use std::bit_cast consistently wherever Clang had been emitting -Wcast-function-type-mismatch warnings, instead of ignoring the diagnostic.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for cleaning up the other instances.

@tshortli tshortli enabled auto-merge January 30, 2025 01:51
@tshortli tshortli force-pushed the bit-cast-everywhere branch from 9a0d90b to 664a933 Compare January 30, 2025 20:55
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli tshortli changed the title Concurrency: Use std::bit_cast over ignoring -Wcast-function-type-mismatch. Concurrency: Use std::bit_cast over ignoring -Wcast-function-type-mismatch Jan 30, 2025
@tshortli
Copy link
Contributor Author

Looks like Windows CI is unhappy:

In file included from C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\stdlib\public\Concurrency\Task.cpp:38:
C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\include\swift/Runtime/STLCompatibility.h(30,1): error: definition with same mangled name '??$bit_cast@P6WXPEAVAsyncContext@swift@@@ZP6WX0PEAX@Z@__swift@std@@YAP6WXPEAVAsyncContext@swift@@@ZAEBQ6WX0PEAX@Z@Z' as another definition
   30 | bit_cast(const Source &src) noexcept {
      | ^
C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\include\swift/Runtime/STLCompatibility.h(30,1): note: previous definition is here
1 error generated.

@compnerd
Copy link
Member

interesting, it is claiming that there is a duplicate definition.

@compnerd
Copy link
Member

I think that this might be a bug in clang? There are a few reports of this being caused with concepts.

@tshortli tshortli closed this Apr 23, 2025
auto-merge was automatically disabled April 23, 2025 16:48

Pull request was closed

@tshortli tshortli deleted the bit-cast-everywhere branch April 23, 2025 16:48
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