Skip to content

[cxx-interop] Fix libstdc++ test failure with CentOS 7 #42364

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
Apr 19, 2022

Conversation

egorzhdan
Copy link
Contributor

This fixes use-std-string.swift & libstdcxx-module-interface.swift.

CentOS 7 comes with an outdated libstdc++ version. In that version, std::basic_string has a mutable member, which makes all of basic_string's member functions mutating in Swift. This prevents us from calling size() or empty() on an immutable value of std.string. We should force these methods to be imported as non-mutating in Swift, but for now let's use var to make the tests pass.

rdar://91548568
rdar://91670704

CentOS 7 comes with an outdated libstdc++ version. In that version, `std::basic_string` has a `mutable` member, which makes all of `basic_string`'s member functions mutating in Swift. This prevents us from calling `size()` or `empty()` on an immutable value of `std.string`.

rdar://91548568
rdar://91670704
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test CentOS 7 platform

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Apr 14, 2022
Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

@egorzhdan egorzhdan merged commit dce480a into main Apr 19, 2022
@egorzhdan egorzhdan deleted the egorzhdan/libstdcxx-centos-test-fix branch April 19, 2022 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants