[cxx-interop] Mark C++ functions with unavailable return type as unav… #67235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ailable
This prevents users from calling functions with unsupported or unavailable return types. This ensures that users don't for example call a function that returns a non-copyable and non-movable type
Fixes #64401
Never
. This works as a placeholder, but it doesn't produce errors to users in all cases. For instance, the user can still call a function and store its value into alet
constant, even if it'sNever
. And then the underlying C++ type won't be correctly operated on, for instance, if it needs to be destroyed with a custom C++ destructor, causing potential leaks. This change plugs this hole by ensuring we at least mark such functions as unavailable when we know that their return type is unsupported. This specific fix is a compromise as it's not ideal to make such a change to the function when computing the return type, but the previous approach of determining this earlier ([5.9][interop] do not import functions whose return type is not imported #65105) didn't work out as it caused semantics issues with some C++ member functions.