Skip to content

[cxx-interop] Cast "data" to the correct type in _swift_dispatch_data_apply. #34266

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

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/public/SwiftShims/DispatchOverlayShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ static inline unsigned int
_swift_dispatch_data_apply(
__swift_shims_dispatch_data_t data,
__swift_shims_dispatch_data_applier SWIFT_DISPATCH_NOESCAPE applier) {
return dispatch_data_apply(data, ^bool(dispatch_data_t data, size_t off, const void *loc, size_t size){
return applier(data, off, loc, size);
return dispatch_data_apply((dispatch_data_t)data, ^bool(dispatch_data_t data, size_t off, const void *loc, size_t size){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative solution would be to update dispatch_data_apply to take a __swift_shims_dispatch_data_t. That would modify a public function to accept a private type so, I figured this solution would be better.

return applier((__swift_shims_dispatch_data_t)data, off, loc, size);
});
}

Expand Down