Skip to content

[cxx-interop] Mangle numeric template arguments #67101

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
Jul 5, 2023

Conversation

egorzhdan
Copy link
Contributor

This fixes linker errors when there are multiple instantiations of a templated struct with numeric template parameters.

When mangling the name of a C++ template specialization, we currently ignore non-type templated parameters. This causes two different instantiations of the same templated type to have the same mangled name, triggering linker errors.

rdar://107757051

@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Jul 3, 2023
@egorzhdan egorzhdan requested review from zoecarver and hyp as code owners July 3, 2023 22:56
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan egorzhdan force-pushed the egorzhdan/mangle-numeric-tmpl-args branch from 9fc88ab to f2ae255 Compare July 4, 2023 13:51
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

2 similar comments
@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

@egorzhdan
Copy link
Contributor Author

@swift-ci please test Windows

@egorzhdan egorzhdan force-pushed the egorzhdan/mangle-numeric-tmpl-args branch from f2ae255 to 5183edf Compare July 5, 2023 12:16
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

This fixes linker errors when there are multiple instantiations of a templated struct with numeric template parameters.

When mangling the name of a C++ template specialization, we currently ignore non-type templated parameters. This causes two different instantiations of the same templated type to have the same mangled name, triggering linker errors.

rdar://107757051
@egorzhdan egorzhdan force-pushed the egorzhdan/mangle-numeric-tmpl-args branch from 5183edf to d4e8551 Compare July 5, 2023 14:28
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

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