-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Initial tests for std::function
usage
#70772
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 |
yay! |
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.
LG, not sure why it's failing :(
The Windows failure is interesting, I think we might be treating
|
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
This makes sure that `std::function` is imported consistently on supported platforms, and that it allows basic usage: calling a function with `callAsFunction`, initializing an empty function, and passing a function retrieved from C++ back to C++ as a parameter. rdar://103979602
c8522eb
to
2d0863a
Compare
@swift-ci please smoke test |
`clangSema.isCompleteType` checks for decl visibility according to the module visibility rules, which we don't actually need. What we need to check is whether the record has a definition – this is the check we already use elsewhere in ClangImporter. This makes sure that we can import `std::function` on Windows. rdar://103979602
@swift-ci please smoke test |
The new failure on Windows:
|
The test was passing by accident: we didn't properly check `std::pair` type for completeness, and assumed that it is incomplete. This updates the test to actually verify the behavior that is specified in the vision document.
@swift-ci please smoke test |
In libstdc++ 11, `std::pair` has a base class `std::__pair_base`, which defines a copy constructor. We still continue not treating `std::pair` as an owned type, just like on other platforms.
@swift-ci please smoke test |
Hmm, adding explicit imports helps with the Windows failure... import CxxStdlib
import CxxStdlib.functional It seems there is something wrong with Clang Sema's module visibility check |
Ahhh we were missing |
@swift-ci please smoke test |
This makes sure that
std::function
is imported consistently on supported platforms, and that it allows basic usage: calling a function withcallAsFunction
, initializing an empty function, and passing a function retrieved from C++ back to C++ as a parameter.rdar://103979602