Skip to content

Commit

Permalink
Merge pull request #77857 from swiftlang/egorzhdan/cxxstdlib-build-cr…
Browse files Browse the repository at this point in the history
…ash-windows

[cxx-interop] Workaround a compiler crash for CxxStdlib on Windows
  • Loading branch information
al45tair authored Nov 28, 2024
2 parents b13544e + 7473eae commit c690fef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stdlib/public/Cxx/std/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ extension std.string: Hashable {
@_alwaysEmitIntoClient
public func hash(into hasher: inout Hasher) {
// Call std::hash<std::string>::operator()
#if os(Windows) // FIXME: https://github.com/swiftlang/swift/issues/77856
let cxxHash = __swift_interopHashOfString().callAsFunction(self)
#else
let cxxHash = __swift_interopComputeHashOfString(self)
#endif
hasher.combine(cxxHash)
}
}
Expand All @@ -207,7 +211,11 @@ extension std.u16string: Hashable {
@_alwaysEmitIntoClient
public func hash(into hasher: inout Hasher) {
// Call std::hash<std::u16string>::operator()
#if os(Windows) // FIXME: https://github.com/swiftlang/swift/issues/77856
let cxxHash = __swift_interopHashOfU16String().callAsFunction(self)
#else
let cxxHash = __swift_interopComputeHashOfU16String(self)
#endif
hasher.combine(cxxHash)
}
}
Expand All @@ -216,7 +224,11 @@ extension std.u32string: Hashable {
@_alwaysEmitIntoClient
public func hash(into hasher: inout Hasher) {
// Call std::hash<std::u32string>::operator()
#if os(Windows) // FIXME: https://github.com/swiftlang/swift/issues/77856
let cxxHash = __swift_interopHashOfU32String().callAsFunction(self)
#else
let cxxHash = __swift_interopComputeHashOfU32String(self)
#endif
hasher.combine(cxxHash)
}
}
Expand Down

0 comments on commit c690fef

Please sign in to comment.