mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This reverts commit 6852bc9834.
In addition to the original change, this makes sure that C++ `std::string` and Swift `String` are given distinct score, in order to prevent ambiguity which was causing build failures in some projects.
rdar://158439395
25 lines
567 B
C++
25 lines
567 B
C++
#include <string>
|
|
|
|
struct HasMethodThatReturnsString {
|
|
int value = 111;
|
|
std::string getString() const { return std::to_string(value); }
|
|
};
|
|
|
|
inline std::string takesStringWithDefaultArg(std::string s = "abc") { return s; }
|
|
|
|
struct StringBox {
|
|
std::string value;
|
|
|
|
friend bool operator==(const StringBox &lhs, const std::string &rhs) {
|
|
return lhs.value == rhs;
|
|
}
|
|
|
|
friend bool operator==(const std::string &lhs, const StringBox &rhs) {
|
|
return rhs == lhs;
|
|
}
|
|
|
|
StringBox operator+(const StringBox &rhs) const {
|
|
return {value + rhs.value};
|
|
}
|
|
};
|