-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Check the safety of C++ template arguments #78522
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
Conversation
@swift-ci please smoke test |
62ff0d6
to
9856c1d
Compare
@swift-ci please smoke test |
@swift-ci please build toolchain macOS |
9856c1d
to
d6499b8
Compare
@swift-ci please smoke test |
lib/ClangImporter/ImportDecl.cpp
Outdated
if (arg.getKind() != clang::TemplateArgument::Type) | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this work with pack arguments, e.g. std::tuple<Safe, Safe, Unsafe>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Added support or that.
Swift imports template specializations as a standalone type (not as an instantiation of a generic) so unsafety is not propagated from the template arguments to the specialization. This PR propagates this information explicitly.
d6499b8
to
f12b48a
Compare
@swift-ci please smoke test |
@swift-ci please smoke test linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Swift imports template specializations as a standalone type (not as an instantiation of a generic) so unsafety is not propagated from the template arguments to the specialization. This PR propagates this information explicitly.