Hey everyone, I have spent some time investigating SR-12802, and have created this patch:
The idea is to check for rvalue references, and allow the overload to always pass by value. However I don't know if this is a viable approach (or maybe there is something wrong in my local environment?) and am looking for feedback/ideas.
I have specifically worked on this based on the push_back
method import, and the overload that is used for vector
. With this patch, it allows to pass by value, however when updating the tests I get a crash (segmentation fault).
tests output:
[ RUN ] StdVector.init
[ OK ] StdVector.init
[ RUN ] StdVector.push back
stderr>>> CRASHED: SIGSEGV
the test crashed unexpectedly
[ FAIL ] StdVector.push back
[ RUN ] StdVector.map
stderr>>> CRASHED: SIGSEGV
the test crashed unexpectedly
[ FAIL ] StdVector.map
StdVector: Some tests failed, aborting
UXPASS: []
FAIL: ["push back", "map"]
SKIP: []
Here is the output for swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/Interop/Cxx/stdlib/Output/use-std-vector.swift.tmp/a.out --stdlib-unittest-in-process --stdlib-unittest-filter "push_back"
objc[69006]: Class _TtCs25CheckedContinuationCanary is implemented in both /usr/lib/swift/libswift_Concurrency.dylib (0x20ced5ee0) and swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/macosx/libswift_Concurrency.dylib (0x1031d48d0). One of the two will be used. Which one is undefined.
objc[69006]: Class _TtCs17DispatchQueueShim is implemented in both /usr/lib/swift/libswift_Concurrency.dylib (0x20ced5f70) and /swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/macosx/libswift_Concurrency.dylib (0x1031d4960). One of the two will be used. Which one is undefined.
objc[69006]: Class _TtCs9MainActor is implemented in both /usr/lib/swift/libswift_Concurrency.dylib (0x20ced6000) and /swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/macosx/libswift_Concurrency.dylib (0x1031d49f8). One of the two will be used. Which one is undefined.
StdlibUnittest: using filter: push back
[ RUN ] StdVector.push back
check failed at /swift-project/swift/test/Interop/Cxx/stdlib/use-std-vector.swift, line 30
first: 0 (of type Swift.Int32)
second: 42 (of type Swift.Int32)
[ FAIL ] StdVector.push back
StdVector: Some tests failed, aborting
UXPASS: []
FAIL: ["push back"]
SKIP: []
Thank you!