Skip to content

[cxx-interop] Only swiftify template instantiations behind type aliases #81973

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
Jun 6, 2025

Conversation

Xazax-hun
Copy link
Contributor

While I could not trigger a scenario where the generated macro triggers a compilation error, the generated code is definitely not valid Swift.

rdar://151422108

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jun 4, 2025
@Xazax-hun Xazax-hun force-pushed the gaborh/disable-non-aliased-instantiations branch from cdb813d to b1b29ce Compare June 4, 2025 14:24
@Xazax-hun Xazax-hun enabled auto-merge June 4, 2025 16:49
@hnrklssn hnrklssn disabled auto-merge June 4, 2025 18:35
Copy link
Contributor

@hnrklssn hnrklssn left a comment

Choose a reason for hiding this comment

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

Actually, I just realised something: what happens if other parameters in the parameter list have un-typedef'd templates? I think we need to check that any template type in the signature is hidden behind a typedef

@Xazax-hun Xazax-hun force-pushed the gaborh/disable-non-aliased-instantiations branch 2 times, most recently from 53f1207 to 4a08305 Compare June 5, 2025 10:58
@Xazax-hun
Copy link
Contributor Author

I think we need to check that any template type in the signature is hidden behind a typedef

Good point, updated the PR.

While I could not trigger a scenario where the generated macro triggers
a compilation error, the generated code is definitely not valid Swift.

rdar://151422108
@Xazax-hun Xazax-hun force-pushed the gaborh/disable-non-aliased-instantiations branch from 4a08305 to 868c85d Compare June 6, 2025 09:32
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@Xazax-hun Xazax-hun merged commit e2ab10b into main Jun 6, 2025
3 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/disable-non-aliased-instantiations branch June 6, 2025 16:18
Xazax-hun added a commit that referenced this pull request Jun 9, 2025
…aliases

Explanation: C++ template instantiations that are not behind type
aliases don't have corresponding Swift names that are both syntactically
and semantically valid types. This PR prevents generating swiftified
overloads for those types.
Issue: rdar://151422108
Risk: Low, we swiftify functions less often.
Testing: Regression test added.
Original PR: #81973
Reviewer: @hnrklssn
Xazax-hun added a commit that referenced this pull request Jun 11, 2025
…aliases

Explanation: C++ template instantiations that are not behind type
aliases don't have corresponding Swift names that are both syntactically
and semantically valid types. This PR prevents generating swiftified
overloads for those types.
Issue: rdar://151422108
Risk: Low, we swiftify functions less often.
Testing: Regression test added.
Original PR: #81973
Reviewer: @hnrklssn
Xazax-hun added a commit that referenced this pull request Jun 12, 2025
…aliases

Explanation: C++ template instantiations that are not behind type
aliases don't have corresponding Swift names that are both syntactically
and semantically valid types. This PR prevents generating swiftified
overloads for those types.
Issue: rdar://151422108
Risk: Low, we swiftify functions less often.
Testing: Regression test added.
Original PR: #81973
Reviewer: @hnrklssn
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