Skip to content

Commit a0fc878

Browse files
committed
swift: repair the Windows x86 build
For some reason `numericCast` does not permit casting the flags value: ~~~ S:\SourceCache\swift-corelibs-libdispatch\src\swift\Block.swift:46:39: error: global function 'numericCast' requires that 'dispatch_block_flags_t' conform to 'BinaryInteger' let flags: dispatch_block_flags_t = numericCast(flags.rawValue) ^ Swift.numericCast:1:24: note: where 'U' = 'dispatch_block_flags_t' @inlinable public func numericCast<T, U>(_ x: T) -> U where T : BinaryInteger, U : BinaryInteger ^ S:\SourceCache\swift-corelibs-libdispatch\src\swift\Block.swift:46:39: note: did you mean to use '.rawValue'? let flags: dispatch_block_flags_t = numericCast(flags.rawValue) ^ .rawValue ~~~
1 parent 87ba473 commit a0fc878

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/swift/Block.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ public class DispatchWorkItem {
4040
internal var _block: _DispatchBlock
4141

4242
public init(qos: DispatchQoS = .unspecified, flags: DispatchWorkItemFlags = [], block: @escaping @convention(block) () -> ()) {
43-
#if os(Windows) && (arch(arm64) || arch(x86_64))
43+
#if os(Windows)
44+
#if arch(arm64) || arch(x86_64)
4445
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
46+
#else
47+
let flags = dispatch_block_flags_t(UInt(flags.rawValue))
48+
#endif
4549
#else
4650
let flags: dispatch_block_flags_t = numericCast(flags.rawValue)
4751
#endif
@@ -52,8 +56,12 @@ public class DispatchWorkItem {
5256
// Used by DispatchQueue.synchronously<T> to provide a path through
5357
// dispatch_block_t, as we know the lifetime of the block in question.
5458
internal init(flags: DispatchWorkItemFlags = [], noescapeBlock: () -> ()) {
55-
#if os(Windows) && (arch(arm64) || arch(x86_64))
59+
#if os(Windows)
60+
#if arch(arm64) || arch(x86_64)
5661
let flags = dispatch_block_flags_t(UInt32(flags.rawValue))
62+
#else
63+
let flags = dispatch_block_flags_t(UInt(flags.rawValue))
64+
#endif
5765
#else
5866
let flags: dispatch_block_flags_t = numericCast(flags.rawValue)
5967
#endif

0 commit comments

Comments
 (0)