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

[cxx-interop] Do not add base class members that cause lookup ambigui… #67222

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

hyp
Copy link
Contributor

@hyp hyp commented Jul 11, 2023

…ties with a derived class member of the same name

Fixes #66323

(cherry picked from commit 11d7d58)

  • Explanation: Swift's clang importer adds base class members into a derived class when such a derived C++ class is imported into Swift. However, the importer did not check if the added member could cause an ambiguity between another member in the derived class and the added base member. This caused ambiguity errors when trying to call shadowed or reimplemented base class members from derived class in Swift. This change resolves this by detecting ambiguous base members using their arity and not adding them into the derived class when they conflict with another derived member.
  • Scope: C++ interop, clang importer, base class member import.
  • Risk: Medium, affects how base class members are imported. Tested on some adopters without issues.
  • Testing: Unit tests, adopter testing.
  • Original PR: [cxx-interop] Do not add base class members that cause lookup ambigui… #67178

…ties with a derived class member of the same name

Fixes swiftlang#66323

(cherry picked from commit 11d7d58)
@hyp hyp added c++ interop Feature: Interoperability with C++ swift 5.9 labels Jul 11, 2023
@hyp hyp requested a review from a team as a code owner July 11, 2023 17:23
@hyp
Copy link
Contributor Author

hyp commented Jul 11, 2023

@swift-ci please test

@hyp
Copy link
Contributor Author

hyp commented Jul 11, 2023

@swift-ci please test source compatibility

@hyp hyp merged commit 4d9811e into swiftlang:release/5.9 Jul 12, 2023
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++ swift 5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants