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

[SR-14511] Adding a conversion from UnsafeMutablePointer to UnsafePointer #56863

Open
johnno1962 opened this issue Apr 20, 2021 · 2 comments
Open
Labels
compiler The Swift compiler in itself new feature type checker Area → compiler: Semantic analysis

Comments

@johnno1962
Copy link
Contributor

Previous ID SR-14511
Radar rdar://problem/76906426
Original Reporter @johnno1962
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels New Feature, TypeChecker
Assignee None
Priority Medium

md5: 55a91170174a483a77e32bb3f8b5e054

Issue Description:

Hi Apple,

Something that comes up frequently when using pointers in Swift is the you can not return an UnsafeMutablePointer where an UnsafePointer is expected. In C, mutable pointers can be converted implicitly to "const" pointers. Would it be possible to add such a conversion to Swift without degrading type checking performance? I guess the same would go for UnsafeMutableRawPointers. This would help with code using imports of pointers from C which frequently have reasonably arbitrary mutability.

Cheers,

John

@typesanitizer
Copy link

@swift-ci create

@johnno1962
Copy link
Contributor Author

PR actuated addressing this: #37214

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself new feature type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants