-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++clang importerArea → compiler: The clang importerArea → compiler: The clang importercompilerThe Swift compiler itselfThe Swift compiler itselfownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semanticsswift 6.0unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
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
let x = getCppMoveOnlyType()
consumingFunction(x)
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
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++clang importerArea → compiler: The clang importerArea → compiler: The clang importercompilerThe Swift compiler itselfThe Swift compiler itselfownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semanticsswift 6.0unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output