Files
swift-mirror/test/Interop/Cxx/stdlib/Inputs/std-string-and-vector.h
susmonteiro d81d6547ba [cxx-interop] Fix metadata mismatch regarding fields of structs
In https://github.com/swiftlang/swift/pull/78467 and https://github.com/swiftlang/swift/pull/78961, we stopped emitting metadata for private C++ fields. However, this created a mismatch between the fields emitted and the number of fields + their offsets in the StructDescriptor.

rdar://147263490
(cherry picked from commit 72b13b3b48)
2025-05-23 11:16:09 +01:00

37 lines
830 B
C++

#include <string>
#include <vector>
struct Item {
std::vector<std::string> keys;
std::vector<std::string> values;
};
inline Item get_item() {
return {};
}
std::vector<int> makeVecOfInt() { return {1, 2, 3}; }
std::vector<std::string> makeVecOfString() { return {"Hello", "World"}; }
struct S {
private:
std::string privStr;
std::vector<std::string> privVec;
public:
std::string pubStr;
std::vector<std::string> pubVec;
protected:
std::string protStr;
std::vector<std::string> protVec;
public:
S() : privStr("private"), privVec({"private", "vector"}),
pubStr("public"), pubVec({"a", "public", "vector"}),
protStr("protected"), protVec({"protected", "vector"}) {}
std::vector<std::string> getPrivVec() const { return privVec; }
std::string getProtStr() const { return protStr; }
};