Skip to content

Conversation

egorzhdan
Copy link
Contributor

@egorzhdan egorzhdan commented Jul 24, 2023

Explanation: This prevented std::vector<std::string> from being auto-conformed to CxxRandomAccessCollection. If an iterator type is templated, and does not have an explicit instantiation via a typedef or a using-decl, its specialization will not have an owning Clang module. Make sure we treat it as a part of the Clang module that owns the template decl.
Scope: This changes the logic that auto-conforms the C++ types to protocols from the C++ overlay.
Risk: Low, this only affects the auto-conformance logic.

Original PR: #67482

rdar://112762768 / resolves #67410 (cherry picked from commit af014c0)

This prevented `std::vector<std::string>` from being auto-conformed to `CxxRandomAccessCollection`.

If an iterator type is templated, and does not have an explicit instantiation via a typedef or a using-decl, its specialization will not have an owning Clang module. Make sure we treat it as a part of the Clang module that owns the template decl.

rdar://112762768 / resolves #67410
(cherry picked from commit af014c0)
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jul 24, 2023
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@egorzhdan egorzhdan marked this pull request as ready for review July 24, 2023 17:10
@egorzhdan egorzhdan requested a review from a team as a code owner July 24, 2023 17:10
Copy link
Contributor

@ravikandhadai ravikandhadai left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks Egor.

@egorzhdan egorzhdan merged commit fbb061e into release/5.9 Jul 24, 2023
@egorzhdan egorzhdan deleted the egorzhdan/5.9-vector-of-string branch July 24, 2023 21:30
@DougGregor
Copy link
Member

Yes, this looks safe

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.

3 participants