Passing std.vector to print crashes, is that expected?

When I pass a std::vector to swift's print function like so:

namespace cxx_target{
using StringVector = std::vector<std::string>;
}
import cxx_target

var sv = cxx_target.StringVector() 
print(sv)

It results in an EXC_BAD_ACCESS error.

Is that a normal/expected behaviour (like, for example, a result of UB)?

I vaguely recall it used to work in earlier version of Swift (or well, at least not crash)...
Were there some changes in how it's handled, or is my memory playing tricks on me?

I don't think it's expected. Would you mind filing an issue for this on the toolchain's GitHub issues page?

Not at all.
Here it is: Passing std.vector to print causes EXC_BAD_ACCESS · Issue #81862 · swiftlang/swift · GitHub

@Drejzer thanks for filing the issue!
This is a known bug that is fixed by https://github.com/swiftlang/swift/pull/81035

1 Like