C++ foreign type's dtor needs to be invoked on moved-from objects #77894
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
c++ interop
Feature: Interoperability with C++
clang importer
Area → compiler: The clang importer
compiler
The Swift compiler itself
ownership
Feature: Ownership modifiers and semantics
swift 6.0
unexpected behavior
Bug: Unexpected behavior or incorrect output
Description
When passing a type imported from C++ to a consuming Swift function (or a C++ foreign API taking an rvalue reference), the caller is still responsible for destroying the object (calling the dtor) regardless whether the object.
Reproduction
Expected behavior
The dtor for
x
is invoked after the last use.Environment
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: